mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Additional regression tests for ALTER OPERATOR FAMILY.
Robins Tharakan, reviewed by Szymon Guz
This commit is contained in:
parent
9feeef92fb
commit
e6055061c5
@ -320,6 +320,181 @@ SELECT nspname, opcname, amname, rolname
|
||||
alt_nsp2 | alt_opc2 | hash | regtest_alter_user3
|
||||
(4 rows)
|
||||
|
||||
-- ALTER OPERATOR FAMILY ... ADD/DROP
|
||||
-- Should work. Textbook case of CREATE / ALTER ADD / ALTER DROP / DROP
|
||||
BEGIN TRANSACTION;
|
||||
CREATE OPERATOR FAMILY alt_opf4 USING btree;
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD
|
||||
-- int4 vs int2
|
||||
OPERATOR 1 < (int4, int2) ,
|
||||
OPERATOR 2 <= (int4, int2) ,
|
||||
OPERATOR 3 = (int4, int2) ,
|
||||
OPERATOR 4 >= (int4, int2) ,
|
||||
OPERATOR 5 > (int4, int2) ,
|
||||
FUNCTION 1 btint42cmp(int4, int2);
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING btree DROP
|
||||
-- int4 vs int2
|
||||
OPERATOR 1 (int4, int2) ,
|
||||
OPERATOR 2 (int4, int2) ,
|
||||
OPERATOR 3 (int4, int2) ,
|
||||
OPERATOR 4 (int4, int2) ,
|
||||
OPERATOR 5 (int4, int2) ,
|
||||
FUNCTION 1 (int4, int2) ;
|
||||
DROP OPERATOR FAMILY alt_opf4 USING btree;
|
||||
ROLLBACK;
|
||||
-- Should fail. Invalid values for ALTER OPERATOR FAMILY .. ADD / DROP
|
||||
CREATE OPERATOR FAMILY alt_opf4 USING btree;
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING invalid_index_method ADD OPERATOR 1 < (int4, int2); -- invalid indexing_method
|
||||
ERROR: access method "invalid_index_method" does not exist
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD OPERATOR 6 < (int4, int2); -- operator number should be between 1 and 5
|
||||
ERROR: invalid operator number 6, must be between 1 and 5
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD OPERATOR 0 < (int4, int2); -- operator number should be between 1 and 5
|
||||
ERROR: invalid operator number 0, must be between 1 and 5
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD OPERATOR 1 < ; -- operator without argument types
|
||||
ERROR: operator argument types must be specified in ALTER OPERATOR FAMILY
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD FUNCTION 0 btint42cmp(int4, int2); -- function number should be between 1 and 5
|
||||
ERROR: invalid procedure number 0, must be between 1 and 2
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD FUNCTION 6 btint42cmp(int4, int2); -- function number should be between 1 and 5
|
||||
ERROR: invalid procedure number 6, must be between 1 and 2
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD STORAGE invalid_storage; -- Ensure STORAGE is not a part of ALTER OPERATOR FAMILY
|
||||
ERROR: STORAGE cannot be specified in ALTER OPERATOR FAMILY
|
||||
DROP OPERATOR FAMILY alt_opf4 USING btree;
|
||||
-- Should fail. Need to be SUPERUSER to do ALTER OPERATOR FAMILY .. ADD / DROP
|
||||
BEGIN TRANSACTION;
|
||||
CREATE ROLE regtest_alter_user5 NOSUPERUSER;
|
||||
CREATE OPERATOR FAMILY alt_opf5 USING btree;
|
||||
SET ROLE regtest_alter_user5;
|
||||
ALTER OPERATOR FAMILY alt_opf5 USING btree ADD OPERATOR 1 < (int4, int2), FUNCTION 1 btint42cmp(int4, int2);
|
||||
ERROR: must be superuser to alter an operator family
|
||||
RESET ROLE;
|
||||
ERROR: current transaction is aborted, commands ignored until end of transaction block
|
||||
DROP OPERATOR FAMILY alt_opf5 USING btree;
|
||||
ERROR: current transaction is aborted, commands ignored until end of transaction block
|
||||
ROLLBACK;
|
||||
-- Should fail. Need rights to namespace for ALTER OPERATOR FAMILY .. ADD / DROP
|
||||
BEGIN TRANSACTION;
|
||||
CREATE ROLE regtest_alter_user6;
|
||||
CREATE SCHEMA alt_nsp6;
|
||||
REVOKE ALL ON SCHEMA alt_nsp6 FROM regtest_alter_user6;
|
||||
CREATE OPERATOR FAMILY alt_nsp6.alt_opf6 USING btree;
|
||||
SET ROLE regtest_alter_user6;
|
||||
ALTER OPERATOR FAMILY alt_nsp6.alt_opf6 USING btree ADD OPERATOR 1 < (int4, int2);
|
||||
ERROR: permission denied for schema alt_nsp6
|
||||
ROLLBACK;
|
||||
-- Should fail. Only two arguments required for ALTER OPERATOR FAMILY ... DROP OPERATOR
|
||||
CREATE OPERATOR FAMILY alt_opf7 USING btree;
|
||||
ALTER OPERATOR FAMILY alt_opf7 USING btree ADD OPERATOR 1 < (int4, int2);
|
||||
ALTER OPERATOR FAMILY alt_opf7 USING btree DROP OPERATOR 1 (int4, int2, int8);
|
||||
ERROR: one or two argument types must be specified
|
||||
DROP OPERATOR FAMILY alt_opf7 USING btree;
|
||||
-- Should work. During ALTER OPERATOR FAMILY ... DROP OPERATOR
|
||||
-- when left type is the same as right type, a DROP with only one argument type should work
|
||||
CREATE OPERATOR FAMILY alt_opf8 USING btree;
|
||||
ALTER OPERATOR FAMILY alt_opf8 USING btree ADD OPERATOR 1 < (int4, int4);
|
||||
DROP OPERATOR FAMILY alt_opf8 USING btree;
|
||||
-- Should work. Textbook case of ALTER OPERATOR FAMILY ... ADD OPERATOR with FOR ORDER BY
|
||||
CREATE OPERATOR FAMILY alt_opf9 USING gist;
|
||||
ALTER OPERATOR FAMILY alt_opf9 USING gist ADD OPERATOR 1 < (int4, int4) FOR ORDER BY float_ops;
|
||||
DROP OPERATOR FAMILY alt_opf9 USING gist;
|
||||
-- Should fail. Ensure correct ordering methods in ALTER OPERATOR FAMILY ... ADD OPERATOR .. FOR ORDER BY
|
||||
CREATE OPERATOR FAMILY alt_opf10 USING btree;
|
||||
ALTER OPERATOR FAMILY alt_opf10 USING btree ADD OPERATOR 1 < (int4, int4) FOR ORDER BY float_ops;
|
||||
ERROR: access method "btree" does not support ordering operators
|
||||
DROP OPERATOR FAMILY alt_opf10 USING btree;
|
||||
-- Should work. Textbook case of ALTER OPERATOR FAMILY ... ADD OPERATOR with FOR ORDER BY
|
||||
CREATE OPERATOR FAMILY alt_opf11 USING gist;
|
||||
ALTER OPERATOR FAMILY alt_opf11 USING gist ADD OPERATOR 1 < (int4, int4) FOR ORDER BY float_ops;
|
||||
ALTER OPERATOR FAMILY alt_opf11 USING gist DROP OPERATOR 1 (int4, int4);
|
||||
DROP OPERATOR FAMILY alt_opf11 USING gist;
|
||||
-- Should fail. btree comparison functions should return INTEGER in ALTER OPERATOR FAMILY ... ADD FUNCTION
|
||||
BEGIN TRANSACTION;
|
||||
CREATE OPERATOR FAMILY alt_opf12 USING btree;
|
||||
CREATE FUNCTION fn_opf12 (int4, int2) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL;
|
||||
ALTER OPERATOR FAMILY alt_opf12 USING btree ADD FUNCTION 1 fn_opf12(int4, int2);
|
||||
ERROR: btree comparison procedures must return integer
|
||||
DROP OPERATOR FAMILY alt_opf12 USING btree;
|
||||
ERROR: current transaction is aborted, commands ignored until end of transaction block
|
||||
ROLLBACK;
|
||||
-- Should fail. hash comparison functions should return INTEGER in ALTER OPERATOR FAMILY ... ADD FUNCTION
|
||||
BEGIN TRANSACTION;
|
||||
CREATE OPERATOR FAMILY alt_opf13 USING hash;
|
||||
CREATE FUNCTION fn_opf13 (int4) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL;
|
||||
ALTER OPERATOR FAMILY alt_opf13 USING hash ADD FUNCTION 1 fn_opf13(int4);
|
||||
ERROR: hash procedures must return integer
|
||||
DROP OPERATOR FAMILY alt_opf13 USING hash;
|
||||
ERROR: current transaction is aborted, commands ignored until end of transaction block
|
||||
ROLLBACK;
|
||||
-- Should fail. btree comparison functions should have two arguments in ALTER OPERATOR FAMILY ... ADD FUNCTION
|
||||
BEGIN TRANSACTION;
|
||||
CREATE OPERATOR FAMILY alt_opf14 USING btree;
|
||||
CREATE FUNCTION fn_opf14 (int4) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL;
|
||||
ALTER OPERATOR FAMILY alt_opf14 USING btree ADD FUNCTION 1 fn_opf14(int4);
|
||||
ERROR: btree comparison procedures must have two arguments
|
||||
DROP OPERATOR FAMILY alt_opf14 USING btree;
|
||||
ERROR: current transaction is aborted, commands ignored until end of transaction block
|
||||
ROLLBACK;
|
||||
-- Should fail. hash comparison functions should have one argument in ALTER OPERATOR FAMILY ... ADD FUNCTION
|
||||
BEGIN TRANSACTION;
|
||||
CREATE OPERATOR FAMILY alt_opf15 USING hash;
|
||||
CREATE FUNCTION fn_opf15 (int4, int2) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL;
|
||||
ALTER OPERATOR FAMILY alt_opf15 USING hash ADD FUNCTION 1 fn_opf15(int4, int2);
|
||||
ERROR: hash procedures must have one argument
|
||||
DROP OPERATOR FAMILY alt_opf15 USING hash;
|
||||
ERROR: current transaction is aborted, commands ignored until end of transaction block
|
||||
ROLLBACK;
|
||||
-- Should fail. In gist throw an error when giving different data types for function argument
|
||||
-- without defining left / right type in ALTER OPERATOR FAMILY ... ADD FUNCTION
|
||||
CREATE OPERATOR FAMILY alt_opf16 USING gist;
|
||||
ALTER OPERATOR FAMILY alt_opf16 USING gist ADD FUNCTION 1 btint42cmp(int4, int2);
|
||||
ERROR: associated data types must be specified for index support procedure
|
||||
DROP OPERATOR FAMILY alt_opf16 USING gist;
|
||||
-- Should fail. duplicate operator number / function number in ALTER OPERATOR FAMILY ... ADD FUNCTION
|
||||
CREATE OPERATOR FAMILY alt_opf17 USING btree;
|
||||
ALTER OPERATOR FAMILY alt_opf17 USING btree ADD OPERATOR 1 < (int4, int4), OPERATOR 1 < (int4, int4); -- operator # appears twice in same statment
|
||||
ERROR: operator number 1 for (integer,integer) appears more than once
|
||||
ALTER OPERATOR FAMILY alt_opf17 USING btree ADD OPERATOR 1 < (int4, int4); -- operator 1 requested first-time
|
||||
ALTER OPERATOR FAMILY alt_opf17 USING btree ADD OPERATOR 1 < (int4, int4); -- operator 1 requested again in separate statement
|
||||
ERROR: operator 1(integer,integer) already exists in operator family "alt_opf17"
|
||||
ALTER OPERATOR FAMILY alt_opf17 USING btree ADD
|
||||
OPERATOR 1 < (int4, int2) ,
|
||||
OPERATOR 2 <= (int4, int2) ,
|
||||
OPERATOR 3 = (int4, int2) ,
|
||||
OPERATOR 4 >= (int4, int2) ,
|
||||
OPERATOR 5 > (int4, int2) ,
|
||||
FUNCTION 1 btint42cmp(int4, int2) ,
|
||||
FUNCTION 1 btint42cmp(int4, int2); -- procedure 1 appears twice in same statement
|
||||
ERROR: procedure number 1 for (integer,smallint) appears more than once
|
||||
ALTER OPERATOR FAMILY alt_opf17 USING btree ADD
|
||||
OPERATOR 1 < (int4, int2) ,
|
||||
OPERATOR 2 <= (int4, int2) ,
|
||||
OPERATOR 3 = (int4, int2) ,
|
||||
OPERATOR 4 >= (int4, int2) ,
|
||||
OPERATOR 5 > (int4, int2) ,
|
||||
FUNCTION 1 btint42cmp(int4, int2); -- procedure 1 appears first time
|
||||
ALTER OPERATOR FAMILY alt_opf17 USING btree ADD
|
||||
OPERATOR 1 < (int4, int2) ,
|
||||
OPERATOR 2 <= (int4, int2) ,
|
||||
OPERATOR 3 = (int4, int2) ,
|
||||
OPERATOR 4 >= (int4, int2) ,
|
||||
OPERATOR 5 > (int4, int2) ,
|
||||
FUNCTION 1 btint42cmp(int4, int2); -- procedure 1 requested again in separate statement
|
||||
ERROR: operator 1(integer,smallint) already exists in operator family "alt_opf17"
|
||||
DROP OPERATOR FAMILY alt_opf17 USING btree;
|
||||
-- Should fail. Ensure that DROP requests for missing OPERATOR / FUNCTIONS
|
||||
-- return appropriate message in ALTER OPERATOR FAMILY ... DROP OPERATOR / FUNCTION
|
||||
CREATE OPERATOR FAMILY alt_opf18 USING btree;
|
||||
ALTER OPERATOR FAMILY alt_opf18 USING btree DROP OPERATOR 1 (int4, int4);
|
||||
ERROR: operator 1(integer,integer) does not exist in operator family "alt_opf18"
|
||||
ALTER OPERATOR FAMILY alt_opf18 USING btree ADD
|
||||
OPERATOR 1 < (int4, int2) ,
|
||||
OPERATOR 2 <= (int4, int2) ,
|
||||
OPERATOR 3 = (int4, int2) ,
|
||||
OPERATOR 4 >= (int4, int2) ,
|
||||
OPERATOR 5 > (int4, int2) ,
|
||||
FUNCTION 1 btint42cmp(int4, int2);
|
||||
ALTER OPERATOR FAMILY alt_opf18 USING btree DROP FUNCTION 2 (int4, int4);
|
||||
ERROR: function 2(integer,integer) does not exist in operator family "alt_opf18"
|
||||
DROP OPERATOR FAMILY alt_opf18 USING btree;
|
||||
--
|
||||
-- Text Search Dictionary
|
||||
--
|
||||
|
@ -266,6 +266,173 @@ SELECT nspname, opcname, amname, rolname
|
||||
AND n.nspname IN ('alt_nsp1', 'alt_nsp2')
|
||||
ORDER BY nspname, opcname;
|
||||
|
||||
-- ALTER OPERATOR FAMILY ... ADD/DROP
|
||||
|
||||
-- Should work. Textbook case of CREATE / ALTER ADD / ALTER DROP / DROP
|
||||
BEGIN TRANSACTION;
|
||||
CREATE OPERATOR FAMILY alt_opf4 USING btree;
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD
|
||||
-- int4 vs int2
|
||||
OPERATOR 1 < (int4, int2) ,
|
||||
OPERATOR 2 <= (int4, int2) ,
|
||||
OPERATOR 3 = (int4, int2) ,
|
||||
OPERATOR 4 >= (int4, int2) ,
|
||||
OPERATOR 5 > (int4, int2) ,
|
||||
FUNCTION 1 btint42cmp(int4, int2);
|
||||
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING btree DROP
|
||||
-- int4 vs int2
|
||||
OPERATOR 1 (int4, int2) ,
|
||||
OPERATOR 2 (int4, int2) ,
|
||||
OPERATOR 3 (int4, int2) ,
|
||||
OPERATOR 4 (int4, int2) ,
|
||||
OPERATOR 5 (int4, int2) ,
|
||||
FUNCTION 1 (int4, int2) ;
|
||||
DROP OPERATOR FAMILY alt_opf4 USING btree;
|
||||
ROLLBACK;
|
||||
|
||||
-- Should fail. Invalid values for ALTER OPERATOR FAMILY .. ADD / DROP
|
||||
CREATE OPERATOR FAMILY alt_opf4 USING btree;
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING invalid_index_method ADD OPERATOR 1 < (int4, int2); -- invalid indexing_method
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD OPERATOR 6 < (int4, int2); -- operator number should be between 1 and 5
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD OPERATOR 0 < (int4, int2); -- operator number should be between 1 and 5
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD OPERATOR 1 < ; -- operator without argument types
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD FUNCTION 0 btint42cmp(int4, int2); -- function number should be between 1 and 5
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD FUNCTION 6 btint42cmp(int4, int2); -- function number should be between 1 and 5
|
||||
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD STORAGE invalid_storage; -- Ensure STORAGE is not a part of ALTER OPERATOR FAMILY
|
||||
DROP OPERATOR FAMILY alt_opf4 USING btree;
|
||||
|
||||
-- Should fail. Need to be SUPERUSER to do ALTER OPERATOR FAMILY .. ADD / DROP
|
||||
BEGIN TRANSACTION;
|
||||
CREATE ROLE regtest_alter_user5 NOSUPERUSER;
|
||||
CREATE OPERATOR FAMILY alt_opf5 USING btree;
|
||||
SET ROLE regtest_alter_user5;
|
||||
ALTER OPERATOR FAMILY alt_opf5 USING btree ADD OPERATOR 1 < (int4, int2), FUNCTION 1 btint42cmp(int4, int2);
|
||||
RESET ROLE;
|
||||
DROP OPERATOR FAMILY alt_opf5 USING btree;
|
||||
ROLLBACK;
|
||||
|
||||
-- Should fail. Need rights to namespace for ALTER OPERATOR FAMILY .. ADD / DROP
|
||||
BEGIN TRANSACTION;
|
||||
CREATE ROLE regtest_alter_user6;
|
||||
CREATE SCHEMA alt_nsp6;
|
||||
REVOKE ALL ON SCHEMA alt_nsp6 FROM regtest_alter_user6;
|
||||
CREATE OPERATOR FAMILY alt_nsp6.alt_opf6 USING btree;
|
||||
SET ROLE regtest_alter_user6;
|
||||
ALTER OPERATOR FAMILY alt_nsp6.alt_opf6 USING btree ADD OPERATOR 1 < (int4, int2);
|
||||
ROLLBACK;
|
||||
|
||||
-- Should fail. Only two arguments required for ALTER OPERATOR FAMILY ... DROP OPERATOR
|
||||
CREATE OPERATOR FAMILY alt_opf7 USING btree;
|
||||
ALTER OPERATOR FAMILY alt_opf7 USING btree ADD OPERATOR 1 < (int4, int2);
|
||||
ALTER OPERATOR FAMILY alt_opf7 USING btree DROP OPERATOR 1 (int4, int2, int8);
|
||||
DROP OPERATOR FAMILY alt_opf7 USING btree;
|
||||
|
||||
-- Should work. During ALTER OPERATOR FAMILY ... DROP OPERATOR
|
||||
-- when left type is the same as right type, a DROP with only one argument type should work
|
||||
CREATE OPERATOR FAMILY alt_opf8 USING btree;
|
||||
ALTER OPERATOR FAMILY alt_opf8 USING btree ADD OPERATOR 1 < (int4, int4);
|
||||
DROP OPERATOR FAMILY alt_opf8 USING btree;
|
||||
|
||||
-- Should work. Textbook case of ALTER OPERATOR FAMILY ... ADD OPERATOR with FOR ORDER BY
|
||||
CREATE OPERATOR FAMILY alt_opf9 USING gist;
|
||||
ALTER OPERATOR FAMILY alt_opf9 USING gist ADD OPERATOR 1 < (int4, int4) FOR ORDER BY float_ops;
|
||||
DROP OPERATOR FAMILY alt_opf9 USING gist;
|
||||
|
||||
-- Should fail. Ensure correct ordering methods in ALTER OPERATOR FAMILY ... ADD OPERATOR .. FOR ORDER BY
|
||||
CREATE OPERATOR FAMILY alt_opf10 USING btree;
|
||||
ALTER OPERATOR FAMILY alt_opf10 USING btree ADD OPERATOR 1 < (int4, int4) FOR ORDER BY float_ops;
|
||||
DROP OPERATOR FAMILY alt_opf10 USING btree;
|
||||
|
||||
-- Should work. Textbook case of ALTER OPERATOR FAMILY ... ADD OPERATOR with FOR ORDER BY
|
||||
CREATE OPERATOR FAMILY alt_opf11 USING gist;
|
||||
ALTER OPERATOR FAMILY alt_opf11 USING gist ADD OPERATOR 1 < (int4, int4) FOR ORDER BY float_ops;
|
||||
ALTER OPERATOR FAMILY alt_opf11 USING gist DROP OPERATOR 1 (int4, int4);
|
||||
DROP OPERATOR FAMILY alt_opf11 USING gist;
|
||||
|
||||
-- Should fail. btree comparison functions should return INTEGER in ALTER OPERATOR FAMILY ... ADD FUNCTION
|
||||
BEGIN TRANSACTION;
|
||||
CREATE OPERATOR FAMILY alt_opf12 USING btree;
|
||||
CREATE FUNCTION fn_opf12 (int4, int2) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL;
|
||||
ALTER OPERATOR FAMILY alt_opf12 USING btree ADD FUNCTION 1 fn_opf12(int4, int2);
|
||||
DROP OPERATOR FAMILY alt_opf12 USING btree;
|
||||
ROLLBACK;
|
||||
|
||||
-- Should fail. hash comparison functions should return INTEGER in ALTER OPERATOR FAMILY ... ADD FUNCTION
|
||||
BEGIN TRANSACTION;
|
||||
CREATE OPERATOR FAMILY alt_opf13 USING hash;
|
||||
CREATE FUNCTION fn_opf13 (int4) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL;
|
||||
ALTER OPERATOR FAMILY alt_opf13 USING hash ADD FUNCTION 1 fn_opf13(int4);
|
||||
DROP OPERATOR FAMILY alt_opf13 USING hash;
|
||||
ROLLBACK;
|
||||
|
||||
-- Should fail. btree comparison functions should have two arguments in ALTER OPERATOR FAMILY ... ADD FUNCTION
|
||||
BEGIN TRANSACTION;
|
||||
CREATE OPERATOR FAMILY alt_opf14 USING btree;
|
||||
CREATE FUNCTION fn_opf14 (int4) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL;
|
||||
ALTER OPERATOR FAMILY alt_opf14 USING btree ADD FUNCTION 1 fn_opf14(int4);
|
||||
DROP OPERATOR FAMILY alt_opf14 USING btree;
|
||||
ROLLBACK;
|
||||
|
||||
-- Should fail. hash comparison functions should have one argument in ALTER OPERATOR FAMILY ... ADD FUNCTION
|
||||
BEGIN TRANSACTION;
|
||||
CREATE OPERATOR FAMILY alt_opf15 USING hash;
|
||||
CREATE FUNCTION fn_opf15 (int4, int2) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL;
|
||||
ALTER OPERATOR FAMILY alt_opf15 USING hash ADD FUNCTION 1 fn_opf15(int4, int2);
|
||||
DROP OPERATOR FAMILY alt_opf15 USING hash;
|
||||
ROLLBACK;
|
||||
|
||||
-- Should fail. In gist throw an error when giving different data types for function argument
|
||||
-- without defining left / right type in ALTER OPERATOR FAMILY ... ADD FUNCTION
|
||||
CREATE OPERATOR FAMILY alt_opf16 USING gist;
|
||||
ALTER OPERATOR FAMILY alt_opf16 USING gist ADD FUNCTION 1 btint42cmp(int4, int2);
|
||||
DROP OPERATOR FAMILY alt_opf16 USING gist;
|
||||
|
||||
-- Should fail. duplicate operator number / function number in ALTER OPERATOR FAMILY ... ADD FUNCTION
|
||||
CREATE OPERATOR FAMILY alt_opf17 USING btree;
|
||||
ALTER OPERATOR FAMILY alt_opf17 USING btree ADD OPERATOR 1 < (int4, int4), OPERATOR 1 < (int4, int4); -- operator # appears twice in same statment
|
||||
ALTER OPERATOR FAMILY alt_opf17 USING btree ADD OPERATOR 1 < (int4, int4); -- operator 1 requested first-time
|
||||
ALTER OPERATOR FAMILY alt_opf17 USING btree ADD OPERATOR 1 < (int4, int4); -- operator 1 requested again in separate statement
|
||||
ALTER OPERATOR FAMILY alt_opf17 USING btree ADD
|
||||
OPERATOR 1 < (int4, int2) ,
|
||||
OPERATOR 2 <= (int4, int2) ,
|
||||
OPERATOR 3 = (int4, int2) ,
|
||||
OPERATOR 4 >= (int4, int2) ,
|
||||
OPERATOR 5 > (int4, int2) ,
|
||||
FUNCTION 1 btint42cmp(int4, int2) ,
|
||||
FUNCTION 1 btint42cmp(int4, int2); -- procedure 1 appears twice in same statement
|
||||
ALTER OPERATOR FAMILY alt_opf17 USING btree ADD
|
||||
OPERATOR 1 < (int4, int2) ,
|
||||
OPERATOR 2 <= (int4, int2) ,
|
||||
OPERATOR 3 = (int4, int2) ,
|
||||
OPERATOR 4 >= (int4, int2) ,
|
||||
OPERATOR 5 > (int4, int2) ,
|
||||
FUNCTION 1 btint42cmp(int4, int2); -- procedure 1 appears first time
|
||||
ALTER OPERATOR FAMILY alt_opf17 USING btree ADD
|
||||
OPERATOR 1 < (int4, int2) ,
|
||||
OPERATOR 2 <= (int4, int2) ,
|
||||
OPERATOR 3 = (int4, int2) ,
|
||||
OPERATOR 4 >= (int4, int2) ,
|
||||
OPERATOR 5 > (int4, int2) ,
|
||||
FUNCTION 1 btint42cmp(int4, int2); -- procedure 1 requested again in separate statement
|
||||
DROP OPERATOR FAMILY alt_opf17 USING btree;
|
||||
|
||||
|
||||
-- Should fail. Ensure that DROP requests for missing OPERATOR / FUNCTIONS
|
||||
-- return appropriate message in ALTER OPERATOR FAMILY ... DROP OPERATOR / FUNCTION
|
||||
CREATE OPERATOR FAMILY alt_opf18 USING btree;
|
||||
ALTER OPERATOR FAMILY alt_opf18 USING btree DROP OPERATOR 1 (int4, int4);
|
||||
ALTER OPERATOR FAMILY alt_opf18 USING btree ADD
|
||||
OPERATOR 1 < (int4, int2) ,
|
||||
OPERATOR 2 <= (int4, int2) ,
|
||||
OPERATOR 3 = (int4, int2) ,
|
||||
OPERATOR 4 >= (int4, int2) ,
|
||||
OPERATOR 5 > (int4, int2) ,
|
||||
FUNCTION 1 btint42cmp(int4, int2);
|
||||
ALTER OPERATOR FAMILY alt_opf18 USING btree DROP FUNCTION 2 (int4, int4);
|
||||
DROP OPERATOR FAMILY alt_opf18 USING btree;
|
||||
|
||||
|
||||
--
|
||||
-- Text Search Dictionary
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user