2010-09-21 04:08:53 +08:00
|
|
|
/* contrib/chkpass/chkpass.sql.in */
|
2007-11-13 12:24:29 +08:00
|
|
|
|
2007-11-11 11:25:35 +08:00
|
|
|
-- Adjust this setting to control where the objects get created.
|
|
|
|
SET search_path = public;
|
2001-05-03 20:32:13 +08:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Input and output functions and the type itself:
|
|
|
|
--
|
|
|
|
|
2007-11-11 11:25:35 +08:00
|
|
|
CREATE OR REPLACE 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
|
|
|
|
2007-11-11 11:25:35 +08:00
|
|
|
CREATE OR REPLACE 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
|
|
|
|
);
|
|
|
|
|
2007-11-11 11:25:35 +08:00
|
|
|
CREATE OR REPLACE 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:
|
|
|
|
--
|
|
|
|
|
2007-11-11 11:25:35 +08:00
|
|
|
CREATE OR REPLACE 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
|
|
|
|
2007-11-11 11:25:35 +08:00
|
|
|
CREATE OR REPLACE 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
|
|
|
|
--
|