2011-02-14 09:06:41 +08:00
|
|
|
/* contrib/chkpass/chkpass--1.0.sql */
|
2001-05-03 20:32:13 +08:00
|
|
|
|
2011-10-13 03:45:03 +08:00
|
|
|
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
|
|
|
\echo Use "CREATE EXTENSION chkpass" to load this file. \quit
|
|
|
|
|
2001-05-03 20:32:13 +08:00
|
|
|
--
|
|
|
|
-- Input and output functions and the type itself:
|
|
|
|
--
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION chkpass_in(cstring)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS chkpass
|
|
|
|
AS 'MODULE_PATHNAME'
|
2005-01-30 06:35:02 +08:00
|
|
|
LANGUAGE C STRICT;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION chkpass_out(chkpass)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS cstring
|
|
|
|
AS 'MODULE_PATHNAME'
|
2005-01-30 06:35:02 +08:00
|
|
|
LANGUAGE C STRICT;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
|
|
|
CREATE TYPE chkpass (
|
2001-05-03 20:32:13 +08:00
|
|
|
internallength = 16,
|
|
|
|
input = chkpass_in,
|
|
|
|
output = chkpass_out
|
|
|
|
);
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION raw(chkpass)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME', 'chkpass_rout'
|
2005-01-30 06:35:02 +08:00
|
|
|
LANGUAGE C STRICT;
|
2001-05-03 20:32:13 +08:00
|
|
|
|
|
|
|
--
|
|
|
|
-- The various boolean tests:
|
|
|
|
--
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION eq(chkpass, text)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME', 'chkpass_eq'
|
2005-01-30 06:35:02 +08:00
|
|
|
LANGUAGE C STRICT;
|
2001-05-03 20:32:13 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ne(chkpass, text)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME', 'chkpass_ne'
|
2005-01-30 06:35:02 +08:00
|
|
|
LANGUAGE C STRICT;
|
2001-05-03 20:32:13 +08:00
|
|
|
|
|
|
|
--
|
2007-09-30 07:32:42 +08:00
|
|
|
-- Now the operators.
|
2001-05-03 20:32:13 +08:00
|
|
|
--
|
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
CREATE OPERATOR = (
|
2001-05-03 20:32:13 +08:00
|
|
|
leftarg = chkpass,
|
|
|
|
rightarg = text,
|
2007-09-30 07:32:42 +08:00
|
|
|
negator = <>,
|
2001-05-03 20:32:13 +08:00
|
|
|
procedure = eq
|
|
|
|
);
|
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
CREATE OPERATOR <> (
|
2001-05-03 20:32:13 +08:00
|
|
|
leftarg = chkpass,
|
|
|
|
rightarg = text,
|
|
|
|
negator = =,
|
|
|
|
procedure = ne
|
|
|
|
);
|
|
|
|
|
2001-08-11 02:57:42 +08:00
|
|
|
COMMENT ON TYPE chkpass IS 'password type with checks';
|
2001-05-03 20:32:13 +08:00
|
|
|
|
|
|
|
--
|
|
|
|
-- eof
|
|
|
|
--
|