2015-12-31 23:37:31 +01:00
|
|
|
CREATE FUNCTION alter_op_test_fn(boolean, boolean)
|
2015-07-14 17:17:55 +02:00
|
|
|
RETURNS boolean AS $$ SELECT NULL::BOOLEAN; $$ LANGUAGE sql IMMUTABLE;
|
|
|
|
|
2015-12-31 23:37:31 +01:00
|
|
|
CREATE FUNCTION customcontsel(internal, oid, internal, integer)
|
|
|
|
RETURNS float8 AS 'contsel' LANGUAGE internal STABLE STRICT;
|
|
|
|
|
2015-07-14 17:17:55 +02:00
|
|
|
CREATE OPERATOR === (
|
|
|
|
LEFTARG = boolean,
|
|
|
|
RIGHTARG = boolean,
|
|
|
|
PROCEDURE = alter_op_test_fn,
|
|
|
|
COMMUTATOR = ===,
|
|
|
|
NEGATOR = !==,
|
2015-12-31 23:37:31 +01:00
|
|
|
RESTRICT = customcontsel,
|
2015-07-14 17:17:55 +02:00
|
|
|
JOIN = contjoinsel,
|
|
|
|
HASHES, MERGES
|
|
|
|
);
|
|
|
|
|
2015-12-31 23:37:31 +01:00
|
|
|
SELECT pg_describe_object(refclassid,refobjid,refobjsubid) as ref, deptype
|
|
|
|
FROM pg_depend
|
|
|
|
WHERE classid = 'pg_operator'::regclass AND
|
|
|
|
objid = '===(bool,bool)'::regoperator
|
|
|
|
ORDER BY 1;
|
|
|
|
|
2015-07-14 17:17:55 +02:00
|
|
|
--
|
|
|
|
-- Reset and set params
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER OPERATOR === (boolean, boolean) SET (RESTRICT = NONE);
|
|
|
|
ALTER OPERATOR === (boolean, boolean) SET (JOIN = NONE);
|
|
|
|
|
|
|
|
SELECT oprrest, oprjoin FROM pg_operator WHERE oprname = '==='
|
|
|
|
AND oprleft = 'boolean'::regtype AND oprright = 'boolean'::regtype;
|
|
|
|
|
2015-12-31 23:37:31 +01:00
|
|
|
SELECT pg_describe_object(refclassid,refobjid,refobjsubid) as ref, deptype
|
|
|
|
FROM pg_depend
|
|
|
|
WHERE classid = 'pg_operator'::regclass AND
|
|
|
|
objid = '===(bool,bool)'::regoperator
|
|
|
|
ORDER BY 1;
|
|
|
|
|
2015-07-14 17:17:55 +02:00
|
|
|
ALTER OPERATOR === (boolean, boolean) SET (RESTRICT = contsel);
|
|
|
|
ALTER OPERATOR === (boolean, boolean) SET (JOIN = contjoinsel);
|
|
|
|
|
|
|
|
SELECT oprrest, oprjoin FROM pg_operator WHERE oprname = '==='
|
|
|
|
AND oprleft = 'boolean'::regtype AND oprright = 'boolean'::regtype;
|
|
|
|
|
2015-12-31 23:37:31 +01:00
|
|
|
SELECT pg_describe_object(refclassid,refobjid,refobjsubid) as ref, deptype
|
|
|
|
FROM pg_depend
|
|
|
|
WHERE classid = 'pg_operator'::regclass AND
|
|
|
|
objid = '===(bool,bool)'::regoperator
|
|
|
|
ORDER BY 1;
|
|
|
|
|
2015-07-14 17:17:55 +02:00
|
|
|
ALTER OPERATOR === (boolean, boolean) SET (RESTRICT = NONE, JOIN = NONE);
|
|
|
|
|
|
|
|
SELECT oprrest, oprjoin FROM pg_operator WHERE oprname = '==='
|
|
|
|
AND oprleft = 'boolean'::regtype AND oprright = 'boolean'::regtype;
|
|
|
|
|
2015-12-31 23:37:31 +01:00
|
|
|
SELECT pg_describe_object(refclassid,refobjid,refobjsubid) as ref, deptype
|
|
|
|
FROM pg_depend
|
|
|
|
WHERE classid = 'pg_operator'::regclass AND
|
|
|
|
objid = '===(bool,bool)'::regoperator
|
|
|
|
ORDER BY 1;
|
|
|
|
|
|
|
|
ALTER OPERATOR === (boolean, boolean) SET (RESTRICT = customcontsel, JOIN = contjoinsel);
|
2015-07-14 17:17:55 +02:00
|
|
|
|
|
|
|
SELECT oprrest, oprjoin FROM pg_operator WHERE oprname = '==='
|
|
|
|
AND oprleft = 'boolean'::regtype AND oprright = 'boolean'::regtype;
|
|
|
|
|
2015-12-31 23:37:31 +01:00
|
|
|
SELECT pg_describe_object(refclassid,refobjid,refobjsubid) as ref, deptype
|
|
|
|
FROM pg_depend
|
|
|
|
WHERE classid = 'pg_operator'::regclass AND
|
|
|
|
objid = '===(bool,bool)'::regoperator
|
|
|
|
ORDER BY 1;
|
|
|
|
|
2015-07-14 17:17:55 +02:00
|
|
|
--
|
|
|
|
-- Test invalid options.
|
|
|
|
--
|
|
|
|
ALTER OPERATOR === (boolean, boolean) SET (COMMUTATOR = ====);
|
|
|
|
ALTER OPERATOR === (boolean, boolean) SET (NEGATOR = ====);
|
|
|
|
ALTER OPERATOR === (boolean, boolean) SET (RESTRICT = non_existent_func);
|
|
|
|
ALTER OPERATOR === (boolean, boolean) SET (JOIN = non_existent_func);
|
|
|
|
ALTER OPERATOR === (boolean, boolean) SET (COMMUTATOR = !==);
|
|
|
|
ALTER OPERATOR === (boolean, boolean) SET (NEGATOR = !==);
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Test permission check. Must be owner to ALTER OPERATOR.
|
|
|
|
--
|
2016-07-18 00:42:31 +02:00
|
|
|
CREATE USER regress_alter_op_user;
|
|
|
|
SET SESSION AUTHORIZATION regress_alter_op_user;
|
2015-07-14 17:17:55 +02:00
|
|
|
|
|
|
|
ALTER OPERATOR === (boolean, boolean) SET (RESTRICT = NONE);
|
|
|
|
|
|
|
|
-- Clean up
|
2015-07-17 20:10:52 +02:00
|
|
|
RESET SESSION AUTHORIZATION;
|
2016-07-18 00:42:31 +02:00
|
|
|
DROP USER regress_alter_op_user;
|
2015-07-14 17:17:55 +02:00
|
|
|
DROP OPERATOR === (boolean, boolean);
|
2015-12-31 23:37:31 +01:00
|
|
|
DROP FUNCTION customcontsel(internal, oid, internal, integer);
|
|
|
|
DROP FUNCTION alter_op_test_fn(boolean, boolean);
|