2 -- Test for ALTER some_object {RENAME TO, OWNER TO, SET SCHEMA}
4 -- directory paths and dlsuffix are passed to us in environment variables
5 \getenv libdir PG_LIBDIR
6 \getenv dlsuffix PG_DLSUFFIX
7 \set regresslib :libdir '/regress' :dlsuffix
8 CREATE FUNCTION test_opclass_options_func(internal)
10 AS :'regresslib', 'test_opclass_options_func'
12 -- Clean up in case a prior regression run failed
13 SET client_min_messages TO 'warning';
14 DROP ROLE IF EXISTS regress_alter_generic_user1;
15 DROP ROLE IF EXISTS regress_alter_generic_user2;
16 DROP ROLE IF EXISTS regress_alter_generic_user3;
17 RESET client_min_messages;
18 CREATE USER regress_alter_generic_user3;
19 CREATE USER regress_alter_generic_user2;
20 CREATE USER regress_alter_generic_user1 IN ROLE regress_alter_generic_user3;
21 CREATE SCHEMA alt_nsp1;
22 CREATE SCHEMA alt_nsp2;
23 GRANT ALL ON SCHEMA alt_nsp1, alt_nsp2 TO public;
24 SET search_path = alt_nsp1, public;
26 -- Function and Aggregate
28 SET SESSION AUTHORIZATION regress_alter_generic_user1;
29 CREATE FUNCTION alt_func1(int) RETURNS int LANGUAGE sql
31 CREATE FUNCTION alt_func2(int) RETURNS int LANGUAGE sql
33 CREATE AGGREGATE alt_agg1 (
34 sfunc1 = int4pl, basetype = int4, stype1 = int4, initcond = 0
36 CREATE AGGREGATE alt_agg2 (
37 sfunc1 = int4mi, basetype = int4, stype1 = int4, initcond = 0
39 ALTER AGGREGATE alt_func1(int) RENAME TO alt_func3; -- failed (not aggregate)
40 ERROR: function alt_func1(integer) is not an aggregate
41 ALTER AGGREGATE alt_func1(int) OWNER TO regress_alter_generic_user3; -- failed (not aggregate)
42 ERROR: function alt_func1(integer) is not an aggregate
43 ALTER AGGREGATE alt_func1(int) SET SCHEMA alt_nsp2; -- failed (not aggregate)
44 ERROR: function alt_func1(integer) is not an aggregate
45 ALTER FUNCTION alt_func1(int) RENAME TO alt_func2; -- failed (name conflict)
46 ERROR: function alt_func2(integer) already exists in schema "alt_nsp1"
47 ALTER FUNCTION alt_func1(int) RENAME TO alt_func3; -- OK
48 ALTER FUNCTION alt_func2(int) OWNER TO regress_alter_generic_user2; -- failed (no role membership)
49 ERROR: must be able to SET ROLE "regress_alter_generic_user2"
50 ALTER FUNCTION alt_func2(int) OWNER TO regress_alter_generic_user3; -- OK
51 ALTER FUNCTION alt_func2(int) SET SCHEMA alt_nsp1; -- OK, already there
52 ALTER FUNCTION alt_func2(int) SET SCHEMA alt_nsp2; -- OK
53 ALTER AGGREGATE alt_agg1(int) RENAME TO alt_agg2; -- failed (name conflict)
54 ERROR: function alt_agg2(integer) already exists in schema "alt_nsp1"
55 ALTER AGGREGATE alt_agg1(int) RENAME TO alt_agg3; -- OK
56 ALTER AGGREGATE alt_agg2(int) OWNER TO regress_alter_generic_user2; -- failed (no role membership)
57 ERROR: must be able to SET ROLE "regress_alter_generic_user2"
58 ALTER AGGREGATE alt_agg2(int) OWNER TO regress_alter_generic_user3; -- OK
59 ALTER AGGREGATE alt_agg2(int) SET SCHEMA alt_nsp2; -- OK
60 SET SESSION AUTHORIZATION regress_alter_generic_user2;
61 CREATE FUNCTION alt_func1(int) RETURNS int LANGUAGE sql
63 CREATE FUNCTION alt_func2(int) RETURNS int LANGUAGE sql
65 CREATE AGGREGATE alt_agg1 (
66 sfunc1 = int4pl, basetype = int4, stype1 = int4, initcond = 100
68 CREATE AGGREGATE alt_agg2 (
69 sfunc1 = int4mi, basetype = int4, stype1 = int4, initcond = -100
71 ALTER FUNCTION alt_func3(int) RENAME TO alt_func4; -- failed (not owner)
72 ERROR: must be owner of function alt_func3
73 ALTER FUNCTION alt_func1(int) RENAME TO alt_func4; -- OK
74 ALTER FUNCTION alt_func3(int) OWNER TO regress_alter_generic_user2; -- failed (not owner)
75 ERROR: must be owner of function alt_func3
76 ALTER FUNCTION alt_func2(int) OWNER TO regress_alter_generic_user3; -- failed (no role membership)
77 ERROR: must be able to SET ROLE "regress_alter_generic_user3"
78 ALTER FUNCTION alt_func3(int) SET SCHEMA alt_nsp2; -- failed (not owner)
79 ERROR: must be owner of function alt_func3
80 ALTER FUNCTION alt_func2(int) SET SCHEMA alt_nsp2; -- failed (name conflicts)
81 ERROR: function alt_func2(integer) already exists in schema "alt_nsp2"
82 ALTER AGGREGATE alt_agg3(int) RENAME TO alt_agg4; -- failed (not owner)
83 ERROR: must be owner of function alt_agg3
84 ALTER AGGREGATE alt_agg1(int) RENAME TO alt_agg4; -- OK
85 ALTER AGGREGATE alt_agg3(int) OWNER TO regress_alter_generic_user2; -- failed (not owner)
86 ERROR: must be owner of function alt_agg3
87 ALTER AGGREGATE alt_agg2(int) OWNER TO regress_alter_generic_user3; -- failed (no role membership)
88 ERROR: must be able to SET ROLE "regress_alter_generic_user3"
89 ALTER AGGREGATE alt_agg3(int) SET SCHEMA alt_nsp2; -- failed (not owner)
90 ERROR: must be owner of function alt_agg3
91 ALTER AGGREGATE alt_agg2(int) SET SCHEMA alt_nsp2; -- failed (name conflict)
92 ERROR: function alt_agg2(integer) already exists in schema "alt_nsp2"
93 RESET SESSION AUTHORIZATION;
94 SELECT n.nspname, proname, prorettype::regtype, prokind, a.rolname
95 FROM pg_proc p, pg_namespace n, pg_authid a
96 WHERE p.pronamespace = n.oid AND p.proowner = a.oid
97 AND n.nspname IN ('alt_nsp1', 'alt_nsp2')
98 ORDER BY nspname, proname;
99 nspname | proname | prorettype | prokind | rolname
100 ----------+-----------+------------+---------+-----------------------------
101 alt_nsp1 | alt_agg2 | integer | a | regress_alter_generic_user2
102 alt_nsp1 | alt_agg3 | integer | a | regress_alter_generic_user1
103 alt_nsp1 | alt_agg4 | integer | a | regress_alter_generic_user2
104 alt_nsp1 | alt_func2 | integer | f | regress_alter_generic_user2
105 alt_nsp1 | alt_func3 | integer | f | regress_alter_generic_user1
106 alt_nsp1 | alt_func4 | integer | f | regress_alter_generic_user2
107 alt_nsp2 | alt_agg2 | integer | a | regress_alter_generic_user3
108 alt_nsp2 | alt_func2 | integer | f | regress_alter_generic_user3
112 -- We would test collations here, but it's not possible because the error
113 -- messages tend to be nonportable.
118 SET SESSION AUTHORIZATION regress_alter_generic_user1;
119 CREATE CONVERSION alt_conv1 FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
120 CREATE CONVERSION alt_conv2 FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
121 ALTER CONVERSION alt_conv1 RENAME TO alt_conv2; -- failed (name conflict)
122 ERROR: conversion "alt_conv2" already exists in schema "alt_nsp1"
123 ALTER CONVERSION alt_conv1 RENAME TO alt_conv3; -- OK
124 ALTER CONVERSION alt_conv2 OWNER TO regress_alter_generic_user2; -- failed (no role membership)
125 ERROR: must be able to SET ROLE "regress_alter_generic_user2"
126 ALTER CONVERSION alt_conv2 OWNER TO regress_alter_generic_user3; -- OK
127 ALTER CONVERSION alt_conv2 SET SCHEMA alt_nsp2; -- OK
128 SET SESSION AUTHORIZATION regress_alter_generic_user2;
129 CREATE CONVERSION alt_conv1 FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
130 CREATE CONVERSION alt_conv2 FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
131 ALTER CONVERSION alt_conv3 RENAME TO alt_conv4; -- failed (not owner)
132 ERROR: must be owner of conversion alt_conv3
133 ALTER CONVERSION alt_conv1 RENAME TO alt_conv4; -- OK
134 ALTER CONVERSION alt_conv3 OWNER TO regress_alter_generic_user2; -- failed (not owner)
135 ERROR: must be owner of conversion alt_conv3
136 ALTER CONVERSION alt_conv2 OWNER TO regress_alter_generic_user3; -- failed (no role membership)
137 ERROR: must be able to SET ROLE "regress_alter_generic_user3"
138 ALTER CONVERSION alt_conv3 SET SCHEMA alt_nsp2; -- failed (not owner)
139 ERROR: must be owner of conversion alt_conv3
140 ALTER CONVERSION alt_conv2 SET SCHEMA alt_nsp2; -- failed (name conflict)
141 ERROR: conversion "alt_conv2" already exists in schema "alt_nsp2"
142 RESET SESSION AUTHORIZATION;
143 SELECT n.nspname, c.conname, a.rolname
144 FROM pg_conversion c, pg_namespace n, pg_authid a
145 WHERE c.connamespace = n.oid AND c.conowner = a.oid
146 AND n.nspname IN ('alt_nsp1', 'alt_nsp2')
147 ORDER BY nspname, conname;
148 nspname | conname | rolname
149 ----------+-----------+-----------------------------
150 alt_nsp1 | alt_conv2 | regress_alter_generic_user2
151 alt_nsp1 | alt_conv3 | regress_alter_generic_user1
152 alt_nsp1 | alt_conv4 | regress_alter_generic_user2
153 alt_nsp2 | alt_conv2 | regress_alter_generic_user3
157 -- Foreign Data Wrapper and Foreign Server
159 CREATE FOREIGN DATA WRAPPER alt_fdw1;
160 CREATE FOREIGN DATA WRAPPER alt_fdw2;
161 CREATE SERVER alt_fserv1 FOREIGN DATA WRAPPER alt_fdw1;
162 CREATE SERVER alt_fserv2 FOREIGN DATA WRAPPER alt_fdw2;
163 ALTER FOREIGN DATA WRAPPER alt_fdw1 RENAME TO alt_fdw2; -- failed (name conflict)
164 ERROR: foreign-data wrapper "alt_fdw2" already exists
165 ALTER FOREIGN DATA WRAPPER alt_fdw1 RENAME TO alt_fdw3; -- OK
166 ALTER SERVER alt_fserv1 RENAME TO alt_fserv2; -- failed (name conflict)
167 ERROR: server "alt_fserv2" already exists
168 ALTER SERVER alt_fserv1 RENAME TO alt_fserv3; -- OK
169 SELECT fdwname FROM pg_foreign_data_wrapper WHERE fdwname like 'alt_fdw%';
176 SELECT srvname FROM pg_foreign_server WHERE srvname like 'alt_fserv%';
184 -- Procedural Language
186 CREATE LANGUAGE alt_lang1 HANDLER plpgsql_call_handler;
187 CREATE LANGUAGE alt_lang2 HANDLER plpgsql_call_handler;
188 ALTER LANGUAGE alt_lang1 OWNER TO regress_alter_generic_user1; -- OK
189 ALTER LANGUAGE alt_lang2 OWNER TO regress_alter_generic_user2; -- OK
190 SET SESSION AUTHORIZATION regress_alter_generic_user1;
191 ALTER LANGUAGE alt_lang1 RENAME TO alt_lang2; -- failed (name conflict)
192 ERROR: language "alt_lang2" already exists
193 ALTER LANGUAGE alt_lang2 RENAME TO alt_lang3; -- failed (not owner)
194 ERROR: must be owner of language alt_lang2
195 ALTER LANGUAGE alt_lang1 RENAME TO alt_lang3; -- OK
196 ALTER LANGUAGE alt_lang2 OWNER TO regress_alter_generic_user3; -- failed (not owner)
197 ERROR: must be owner of language alt_lang2
198 ALTER LANGUAGE alt_lang3 OWNER TO regress_alter_generic_user2; -- failed (no role membership)
199 ERROR: must be able to SET ROLE "regress_alter_generic_user2"
200 ALTER LANGUAGE alt_lang3 OWNER TO regress_alter_generic_user3; -- OK
201 RESET SESSION AUTHORIZATION;
202 SELECT lanname, a.rolname
203 FROM pg_language l, pg_authid a
204 WHERE l.lanowner = a.oid AND l.lanname like 'alt_lang%'
207 -----------+-----------------------------
208 alt_lang2 | regress_alter_generic_user2
209 alt_lang3 | regress_alter_generic_user3
215 SET SESSION AUTHORIZATION regress_alter_generic_user1;
216 CREATE OPERATOR @-@ ( leftarg = int4, rightarg = int4, procedure = int4mi );
217 CREATE OPERATOR @+@ ( leftarg = int4, rightarg = int4, procedure = int4pl );
218 ALTER OPERATOR @+@(int4, int4) OWNER TO regress_alter_generic_user2; -- failed (no role membership)
219 ERROR: must be able to SET ROLE "regress_alter_generic_user2"
220 ALTER OPERATOR @+@(int4, int4) OWNER TO regress_alter_generic_user3; -- OK
221 ALTER OPERATOR @-@(int4, int4) SET SCHEMA alt_nsp2; -- OK
222 SET SESSION AUTHORIZATION regress_alter_generic_user2;
223 CREATE OPERATOR @-@ ( leftarg = int4, rightarg = int4, procedure = int4mi );
224 ALTER OPERATOR @+@(int4, int4) OWNER TO regress_alter_generic_user2; -- failed (not owner)
225 ERROR: must be owner of operator @+@
226 ALTER OPERATOR @-@(int4, int4) OWNER TO regress_alter_generic_user3; -- failed (no role membership)
227 ERROR: must be able to SET ROLE "regress_alter_generic_user3"
228 ALTER OPERATOR @+@(int4, int4) SET SCHEMA alt_nsp2; -- failed (not owner)
229 ERROR: must be owner of operator @+@
230 -- can't test this: the error message includes the raw oid of namespace
231 -- ALTER OPERATOR @-@(int4, int4) SET SCHEMA alt_nsp2; -- failed (name conflict)
232 RESET SESSION AUTHORIZATION;
233 SELECT n.nspname, oprname, a.rolname,
234 oprleft::regtype, oprright::regtype, oprcode::regproc
235 FROM pg_operator o, pg_namespace n, pg_authid a
236 WHERE o.oprnamespace = n.oid AND o.oprowner = a.oid
237 AND n.nspname IN ('alt_nsp1', 'alt_nsp2')
238 ORDER BY nspname, oprname;
239 nspname | oprname | rolname | oprleft | oprright | oprcode
240 ----------+---------+-----------------------------+---------+----------+---------
241 alt_nsp1 | @+@ | regress_alter_generic_user3 | integer | integer | int4pl
242 alt_nsp1 | @-@ | regress_alter_generic_user2 | integer | integer | int4mi
243 alt_nsp2 | @-@ | regress_alter_generic_user1 | integer | integer | int4mi
247 -- OpFamily and OpClass
249 CREATE OPERATOR FAMILY alt_opf1 USING hash;
250 CREATE OPERATOR FAMILY alt_opf2 USING hash;
251 ALTER OPERATOR FAMILY alt_opf1 USING hash OWNER TO regress_alter_generic_user1;
252 ALTER OPERATOR FAMILY alt_opf2 USING hash OWNER TO regress_alter_generic_user1;
253 CREATE OPERATOR CLASS alt_opc1 FOR TYPE uuid USING hash AS STORAGE uuid;
254 CREATE OPERATOR CLASS alt_opc2 FOR TYPE uuid USING hash AS STORAGE uuid;
255 ALTER OPERATOR CLASS alt_opc1 USING hash OWNER TO regress_alter_generic_user1;
256 ALTER OPERATOR CLASS alt_opc2 USING hash OWNER TO regress_alter_generic_user1;
257 SET SESSION AUTHORIZATION regress_alter_generic_user1;
258 ALTER OPERATOR FAMILY alt_opf1 USING hash RENAME TO alt_opf2; -- failed (name conflict)
259 ERROR: operator family "alt_opf2" for access method "hash" already exists in schema "alt_nsp1"
260 ALTER OPERATOR FAMILY alt_opf1 USING hash RENAME TO alt_opf3; -- OK
261 ALTER OPERATOR FAMILY alt_opf2 USING hash OWNER TO regress_alter_generic_user2; -- failed (no role membership)
262 ERROR: must be able to SET ROLE "regress_alter_generic_user2"
263 ALTER OPERATOR FAMILY alt_opf2 USING hash OWNER TO regress_alter_generic_user3; -- OK
264 ALTER OPERATOR FAMILY alt_opf2 USING hash SET SCHEMA alt_nsp2; -- OK
265 ALTER OPERATOR CLASS alt_opc1 USING hash RENAME TO alt_opc2; -- failed (name conflict)
266 ERROR: operator class "alt_opc2" for access method "hash" already exists in schema "alt_nsp1"
267 ALTER OPERATOR CLASS alt_opc1 USING hash RENAME TO alt_opc3; -- OK
268 ALTER OPERATOR CLASS alt_opc2 USING hash OWNER TO regress_alter_generic_user2; -- failed (no role membership)
269 ERROR: must be able to SET ROLE "regress_alter_generic_user2"
270 ALTER OPERATOR CLASS alt_opc2 USING hash OWNER TO regress_alter_generic_user3; -- OK
271 ALTER OPERATOR CLASS alt_opc2 USING hash SET SCHEMA alt_nsp2; -- OK
272 RESET SESSION AUTHORIZATION;
273 CREATE OPERATOR FAMILY alt_opf1 USING hash;
274 CREATE OPERATOR FAMILY alt_opf2 USING hash;
275 ALTER OPERATOR FAMILY alt_opf1 USING hash OWNER TO regress_alter_generic_user2;
276 ALTER OPERATOR FAMILY alt_opf2 USING hash OWNER TO regress_alter_generic_user2;
277 CREATE OPERATOR CLASS alt_opc1 FOR TYPE macaddr USING hash AS STORAGE macaddr;
278 CREATE OPERATOR CLASS alt_opc2 FOR TYPE macaddr USING hash AS STORAGE macaddr;
279 ALTER OPERATOR CLASS alt_opc1 USING hash OWNER TO regress_alter_generic_user2;
280 ALTER OPERATOR CLASS alt_opc2 USING hash OWNER TO regress_alter_generic_user2;
281 SET SESSION AUTHORIZATION regress_alter_generic_user2;
282 ALTER OPERATOR FAMILY alt_opf3 USING hash RENAME TO alt_opf4; -- failed (not owner)
283 ERROR: must be owner of operator family alt_opf3
284 ALTER OPERATOR FAMILY alt_opf1 USING hash RENAME TO alt_opf4; -- OK
285 ALTER OPERATOR FAMILY alt_opf3 USING hash OWNER TO regress_alter_generic_user2; -- failed (not owner)
286 ERROR: must be owner of operator family alt_opf3
287 ALTER OPERATOR FAMILY alt_opf2 USING hash OWNER TO regress_alter_generic_user3; -- failed (no role membership)
288 ERROR: must be able to SET ROLE "regress_alter_generic_user3"
289 ALTER OPERATOR FAMILY alt_opf3 USING hash SET SCHEMA alt_nsp2; -- failed (not owner)
290 ERROR: must be owner of operator family alt_opf3
291 ALTER OPERATOR FAMILY alt_opf2 USING hash SET SCHEMA alt_nsp2; -- failed (name conflict)
292 ERROR: operator family "alt_opf2" for access method "hash" already exists in schema "alt_nsp2"
293 ALTER OPERATOR CLASS alt_opc3 USING hash RENAME TO alt_opc4; -- failed (not owner)
294 ERROR: must be owner of operator class alt_opc3
295 ALTER OPERATOR CLASS alt_opc1 USING hash RENAME TO alt_opc4; -- OK
296 ALTER OPERATOR CLASS alt_opc3 USING hash OWNER TO regress_alter_generic_user2; -- failed (not owner)
297 ERROR: must be owner of operator class alt_opc3
298 ALTER OPERATOR CLASS alt_opc2 USING hash OWNER TO regress_alter_generic_user3; -- failed (no role membership)
299 ERROR: must be able to SET ROLE "regress_alter_generic_user3"
300 ALTER OPERATOR CLASS alt_opc3 USING hash SET SCHEMA alt_nsp2; -- failed (not owner)
301 ERROR: must be owner of operator class alt_opc3
302 ALTER OPERATOR CLASS alt_opc2 USING hash SET SCHEMA alt_nsp2; -- failed (name conflict)
303 ERROR: operator class "alt_opc2" for access method "hash" already exists in schema "alt_nsp2"
304 RESET SESSION AUTHORIZATION;
305 SELECT nspname, opfname, amname, rolname
306 FROM pg_opfamily o, pg_am m, pg_namespace n, pg_authid a
307 WHERE o.opfmethod = m.oid AND o.opfnamespace = n.oid AND o.opfowner = a.oid
308 AND n.nspname IN ('alt_nsp1', 'alt_nsp2')
309 AND NOT opfname LIKE 'alt_opc%'
310 ORDER BY nspname, opfname;
311 nspname | opfname | amname | rolname
312 ----------+----------+--------+-----------------------------
313 alt_nsp1 | alt_opf2 | hash | regress_alter_generic_user2
314 alt_nsp1 | alt_opf3 | hash | regress_alter_generic_user1
315 alt_nsp1 | alt_opf4 | hash | regress_alter_generic_user2
316 alt_nsp2 | alt_opf2 | hash | regress_alter_generic_user3
319 SELECT nspname, opcname, amname, rolname
320 FROM pg_opclass o, pg_am m, pg_namespace n, pg_authid a
321 WHERE o.opcmethod = m.oid AND o.opcnamespace = n.oid AND o.opcowner = a.oid
322 AND n.nspname IN ('alt_nsp1', 'alt_nsp2')
323 ORDER BY nspname, opcname;
324 nspname | opcname | amname | rolname
325 ----------+----------+--------+-----------------------------
326 alt_nsp1 | alt_opc2 | hash | regress_alter_generic_user2
327 alt_nsp1 | alt_opc3 | hash | regress_alter_generic_user1
328 alt_nsp1 | alt_opc4 | hash | regress_alter_generic_user2
329 alt_nsp2 | alt_opc2 | hash | regress_alter_generic_user3
332 -- ALTER OPERATOR FAMILY ... ADD/DROP
333 -- Should work. Textbook case of CREATE / ALTER ADD / ALTER DROP / DROP
335 CREATE OPERATOR FAMILY alt_opf4 USING btree;
336 ALTER OPERATOR FAMILY alt_opf4 USING btree ADD
338 OPERATOR 1 < (int4, int2) ,
339 OPERATOR 2 <= (int4, int2) ,
340 OPERATOR 3 = (int4, int2) ,
341 OPERATOR 4 >= (int4, int2) ,
342 OPERATOR 5 > (int4, int2) ,
343 FUNCTION 1 btint42cmp(int4, int2);
344 ALTER OPERATOR FAMILY alt_opf4 USING btree DROP
346 OPERATOR 1 (int4, int2) ,
347 OPERATOR 2 (int4, int2) ,
348 OPERATOR 3 (int4, int2) ,
349 OPERATOR 4 (int4, int2) ,
350 OPERATOR 5 (int4, int2) ,
351 FUNCTION 1 (int4, int2) ;
352 DROP OPERATOR FAMILY alt_opf4 USING btree;
354 -- Should fail. Invalid values for ALTER OPERATOR FAMILY .. ADD / DROP
355 CREATE OPERATOR FAMILY alt_opf4 USING btree;
356 ALTER OPERATOR FAMILY alt_opf4 USING invalid_index_method ADD OPERATOR 1 < (int4, int2); -- invalid indexing_method
357 ERROR: access method "invalid_index_method" does not exist
358 ALTER OPERATOR FAMILY alt_opf4 USING btree ADD OPERATOR 6 < (int4, int2); -- operator number should be between 1 and 5
359 ERROR: invalid operator number 6, must be between 1 and 5
360 ALTER OPERATOR FAMILY alt_opf4 USING btree ADD OPERATOR 0 < (int4, int2); -- operator number should be between 1 and 5
361 ERROR: invalid operator number 0, must be between 1 and 5
362 ALTER OPERATOR FAMILY alt_opf4 USING btree ADD OPERATOR 1 < ; -- operator without argument types
363 ERROR: operator argument types must be specified in ALTER OPERATOR FAMILY
364 ALTER OPERATOR FAMILY alt_opf4 USING btree ADD FUNCTION 0 btint42cmp(int4, int2); -- invalid options parsing function
365 ERROR: invalid function number 0, must be between 1 and 5
366 ALTER OPERATOR FAMILY alt_opf4 USING btree ADD FUNCTION 6 btint42cmp(int4, int2); -- function number should be between 1 and 5
367 ERROR: invalid function number 6, must be between 1 and 5
368 ALTER OPERATOR FAMILY alt_opf4 USING btree ADD STORAGE invalid_storage; -- Ensure STORAGE is not a part of ALTER OPERATOR FAMILY
369 ERROR: STORAGE cannot be specified in ALTER OPERATOR FAMILY
370 DROP OPERATOR FAMILY alt_opf4 USING btree;
371 -- Should fail. Need to be SUPERUSER to do ALTER OPERATOR FAMILY .. ADD / DROP
373 CREATE ROLE regress_alter_generic_user5 NOSUPERUSER;
374 CREATE OPERATOR FAMILY alt_opf5 USING btree;
375 SET ROLE regress_alter_generic_user5;
376 ALTER OPERATOR FAMILY alt_opf5 USING btree ADD OPERATOR 1 < (int4, int2), FUNCTION 1 btint42cmp(int4, int2);
377 ERROR: must be superuser to alter an operator family
379 ERROR: current transaction is aborted, commands ignored until end of transaction block
380 DROP OPERATOR FAMILY alt_opf5 USING btree;
381 ERROR: current transaction is aborted, commands ignored until end of transaction block
383 -- Should fail. Need rights to namespace for ALTER OPERATOR FAMILY .. ADD / DROP
385 CREATE ROLE regress_alter_generic_user6;
386 CREATE SCHEMA alt_nsp6;
387 REVOKE ALL ON SCHEMA alt_nsp6 FROM regress_alter_generic_user6;
388 CREATE OPERATOR FAMILY alt_nsp6.alt_opf6 USING btree;
389 SET ROLE regress_alter_generic_user6;
390 ALTER OPERATOR FAMILY alt_nsp6.alt_opf6 USING btree ADD OPERATOR 1 < (int4, int2);
391 ERROR: permission denied for schema alt_nsp6
393 -- Should fail. Only two arguments required for ALTER OPERATOR FAMILY ... DROP OPERATOR
394 CREATE OPERATOR FAMILY alt_opf7 USING btree;
395 ALTER OPERATOR FAMILY alt_opf7 USING btree ADD OPERATOR 1 < (int4, int2);
396 ALTER OPERATOR FAMILY alt_opf7 USING btree DROP OPERATOR 1 (int4, int2, int8);
397 ERROR: one or two argument types must be specified
398 DROP OPERATOR FAMILY alt_opf7 USING btree;
399 -- Should work. During ALTER OPERATOR FAMILY ... DROP OPERATOR
400 -- when left type is the same as right type, a DROP with only one argument type should work
401 CREATE OPERATOR FAMILY alt_opf8 USING btree;
402 ALTER OPERATOR FAMILY alt_opf8 USING btree ADD OPERATOR 1 < (int4, int4);
403 DROP OPERATOR FAMILY alt_opf8 USING btree;
404 -- Should work. Textbook case of ALTER OPERATOR FAMILY ... ADD OPERATOR with FOR ORDER BY
405 CREATE OPERATOR FAMILY alt_opf9 USING gist;
406 ALTER OPERATOR FAMILY alt_opf9 USING gist ADD OPERATOR 1 < (int4, int4) FOR ORDER BY float_ops;
407 DROP OPERATOR FAMILY alt_opf9 USING gist;
408 -- Should fail. Ensure correct ordering methods in ALTER OPERATOR FAMILY ... ADD OPERATOR .. FOR ORDER BY
409 CREATE OPERATOR FAMILY alt_opf10 USING btree;
410 ALTER OPERATOR FAMILY alt_opf10 USING btree ADD OPERATOR 1 < (int4, int4) FOR ORDER BY float_ops;
411 ERROR: access method "btree" does not support ordering operators
412 DROP OPERATOR FAMILY alt_opf10 USING btree;
413 -- Should work. Textbook case of ALTER OPERATOR FAMILY ... ADD OPERATOR with FOR ORDER BY
414 CREATE OPERATOR FAMILY alt_opf11 USING gist;
415 ALTER OPERATOR FAMILY alt_opf11 USING gist ADD OPERATOR 1 < (int4, int4) FOR ORDER BY float_ops;
416 ALTER OPERATOR FAMILY alt_opf11 USING gist DROP OPERATOR 1 (int4, int4);
417 DROP OPERATOR FAMILY alt_opf11 USING gist;
418 -- Should fail. btree comparison functions should return INTEGER in ALTER OPERATOR FAMILY ... ADD FUNCTION
420 CREATE OPERATOR FAMILY alt_opf12 USING btree;
421 CREATE FUNCTION fn_opf12 (int4, int2) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL;
422 ALTER OPERATOR FAMILY alt_opf12 USING btree ADD FUNCTION 1 fn_opf12(int4, int2);
423 ERROR: btree comparison functions must return integer
424 DROP OPERATOR FAMILY alt_opf12 USING btree;
425 ERROR: current transaction is aborted, commands ignored until end of transaction block
427 -- Should fail. hash comparison functions should return INTEGER in ALTER OPERATOR FAMILY ... ADD FUNCTION
429 CREATE OPERATOR FAMILY alt_opf13 USING hash;
430 CREATE FUNCTION fn_opf13 (int4) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL;
431 ALTER OPERATOR FAMILY alt_opf13 USING hash ADD FUNCTION 1 fn_opf13(int4);
432 ERROR: hash function 1 must return integer
433 DROP OPERATOR FAMILY alt_opf13 USING hash;
434 ERROR: current transaction is aborted, commands ignored until end of transaction block
436 -- Should fail. btree comparison functions should have two arguments in ALTER OPERATOR FAMILY ... ADD FUNCTION
438 CREATE OPERATOR FAMILY alt_opf14 USING btree;
439 CREATE FUNCTION fn_opf14 (int4) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL;
440 ALTER OPERATOR FAMILY alt_opf14 USING btree ADD FUNCTION 1 fn_opf14(int4);
441 ERROR: btree comparison functions must have two arguments
442 DROP OPERATOR FAMILY alt_opf14 USING btree;
443 ERROR: current transaction is aborted, commands ignored until end of transaction block
445 -- Should fail. hash comparison functions should have one argument in ALTER OPERATOR FAMILY ... ADD FUNCTION
447 CREATE OPERATOR FAMILY alt_opf15 USING hash;
448 CREATE FUNCTION fn_opf15 (int4, int2) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL;
449 ALTER OPERATOR FAMILY alt_opf15 USING hash ADD FUNCTION 1 fn_opf15(int4, int2);
450 ERROR: hash function 1 must have one argument
451 DROP OPERATOR FAMILY alt_opf15 USING hash;
452 ERROR: current transaction is aborted, commands ignored until end of transaction block
454 -- Should fail. In gist throw an error when giving different data types for function argument
455 -- without defining left / right type in ALTER OPERATOR FAMILY ... ADD FUNCTION
456 CREATE OPERATOR FAMILY alt_opf16 USING gist;
457 ALTER OPERATOR FAMILY alt_opf16 USING gist ADD FUNCTION 1 btint42cmp(int4, int2);
458 ERROR: associated data types must be specified for index support function
459 DROP OPERATOR FAMILY alt_opf16 USING gist;
460 -- Should fail. duplicate operator number / function number in ALTER OPERATOR FAMILY ... ADD FUNCTION
461 CREATE OPERATOR FAMILY alt_opf17 USING btree;
462 ALTER OPERATOR FAMILY alt_opf17 USING btree ADD OPERATOR 1 < (int4, int4), OPERATOR 1 < (int4, int4); -- operator # appears twice in same statement
463 ERROR: operator number 1 for (integer,integer) appears more than once
464 ALTER OPERATOR FAMILY alt_opf17 USING btree ADD OPERATOR 1 < (int4, int4); -- operator 1 requested first-time
465 ALTER OPERATOR FAMILY alt_opf17 USING btree ADD OPERATOR 1 < (int4, int4); -- operator 1 requested again in separate statement
466 ERROR: operator 1(integer,integer) already exists in operator family "alt_opf17"
467 ALTER OPERATOR FAMILY alt_opf17 USING btree ADD
468 OPERATOR 1 < (int4, int2) ,
469 OPERATOR 2 <= (int4, int2) ,
470 OPERATOR 3 = (int4, int2) ,
471 OPERATOR 4 >= (int4, int2) ,
472 OPERATOR 5 > (int4, int2) ,
473 FUNCTION 1 btint42cmp(int4, int2) ,
474 FUNCTION 1 btint42cmp(int4, int2); -- procedure 1 appears twice in same statement
475 ERROR: function number 1 for (integer,smallint) appears more than once
476 ALTER OPERATOR FAMILY alt_opf17 USING btree ADD
477 OPERATOR 1 < (int4, int2) ,
478 OPERATOR 2 <= (int4, int2) ,
479 OPERATOR 3 = (int4, int2) ,
480 OPERATOR 4 >= (int4, int2) ,
481 OPERATOR 5 > (int4, int2) ,
482 FUNCTION 1 btint42cmp(int4, int2); -- procedure 1 appears first time
483 ALTER OPERATOR FAMILY alt_opf17 USING btree ADD
484 OPERATOR 1 < (int4, int2) ,
485 OPERATOR 2 <= (int4, int2) ,
486 OPERATOR 3 = (int4, int2) ,
487 OPERATOR 4 >= (int4, int2) ,
488 OPERATOR 5 > (int4, int2) ,
489 FUNCTION 1 btint42cmp(int4, int2); -- procedure 1 requested again in separate statement
490 ERROR: operator 1(integer,smallint) already exists in operator family "alt_opf17"
491 DROP OPERATOR FAMILY alt_opf17 USING btree;
492 -- Should fail. Ensure that DROP requests for missing OPERATOR / FUNCTIONS
493 -- return appropriate message in ALTER OPERATOR FAMILY ... DROP OPERATOR / FUNCTION
494 CREATE OPERATOR FAMILY alt_opf18 USING btree;
495 ALTER OPERATOR FAMILY alt_opf18 USING btree DROP OPERATOR 1 (int4, int4);
496 ERROR: operator 1(integer,integer) does not exist in operator family "alt_opf18"
497 ALTER OPERATOR FAMILY alt_opf18 USING btree ADD
498 OPERATOR 1 < (int4, int2) ,
499 OPERATOR 2 <= (int4, int2) ,
500 OPERATOR 3 = (int4, int2) ,
501 OPERATOR 4 >= (int4, int2) ,
502 OPERATOR 5 > (int4, int2) ,
503 FUNCTION 1 btint42cmp(int4, int2);
504 -- Should fail. Not allowed to have cross-type equalimage function.
505 ALTER OPERATOR FAMILY alt_opf18 USING btree
506 ADD FUNCTION 4 (int4, int2) btequalimage(oid);
507 ERROR: btree equal image functions must not be cross-type
508 ALTER OPERATOR FAMILY alt_opf18 USING btree DROP FUNCTION 2 (int4, int4);
509 ERROR: function 2(integer,integer) does not exist in operator family "alt_opf18"
510 DROP OPERATOR FAMILY alt_opf18 USING btree;
511 -- Should fail. Invalid opclass options function (#5) specifications.
512 CREATE OPERATOR FAMILY alt_opf19 USING btree;
513 ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 test_opclass_options_func(internal, text[], bool);
514 ERROR: function test_opclass_options_func(internal, text[], boolean) does not exist
515 ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 (int4) btint42cmp(int4, int2);
516 ERROR: invalid operator class options parsing function
517 HINT: Valid signature of operator class options parsing function is (internal) RETURNS void.
518 ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 (int4, int2) btint42cmp(int4, int2);
519 ERROR: left and right associated data types for operator class options parsing functions must match
520 ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 (int4) test_opclass_options_func(internal); -- Ok
521 ALTER OPERATOR FAMILY alt_opf19 USING btree DROP FUNCTION 5 (int4, int4);
522 DROP OPERATOR FAMILY alt_opf19 USING btree;
526 SET SESSION AUTHORIZATION regress_alter_generic_user1;
527 CREATE TABLE alt_regress_1 (a INTEGER, b INTEGER);
528 CREATE STATISTICS alt_stat1 ON a, b FROM alt_regress_1;
529 CREATE STATISTICS alt_stat2 ON a, b FROM alt_regress_1;
530 ALTER STATISTICS alt_stat1 RENAME TO alt_stat2; -- failed (name conflict)
531 ERROR: statistics object "alt_stat2" already exists in schema "alt_nsp1"
532 ALTER STATISTICS alt_stat1 RENAME TO alt_stat3; -- OK
533 ALTER STATISTICS alt_stat2 OWNER TO regress_alter_generic_user2; -- failed (no role membership)
534 ERROR: must be able to SET ROLE "regress_alter_generic_user2"
535 ALTER STATISTICS alt_stat2 OWNER TO regress_alter_generic_user3; -- OK
536 ALTER STATISTICS alt_stat2 SET SCHEMA alt_nsp2; -- OK
537 SET SESSION AUTHORIZATION regress_alter_generic_user2;
538 CREATE TABLE alt_regress_2 (a INTEGER, b INTEGER);
539 CREATE STATISTICS alt_stat1 ON a, b FROM alt_regress_2;
540 CREATE STATISTICS alt_stat2 ON a, b FROM alt_regress_2;
541 ALTER STATISTICS alt_stat3 RENAME TO alt_stat4; -- failed (not owner)
542 ERROR: must be owner of statistics object alt_stat3
543 ALTER STATISTICS alt_stat1 RENAME TO alt_stat4; -- OK
544 ALTER STATISTICS alt_stat3 OWNER TO regress_alter_generic_user2; -- failed (not owner)
545 ERROR: must be owner of statistics object alt_stat3
546 ALTER STATISTICS alt_stat2 OWNER TO regress_alter_generic_user3; -- failed (no role membership)
547 ERROR: must be able to SET ROLE "regress_alter_generic_user3"
548 ALTER STATISTICS alt_stat3 SET SCHEMA alt_nsp2; -- failed (not owner)
549 ERROR: must be owner of statistics object alt_stat3
550 ALTER STATISTICS alt_stat2 SET SCHEMA alt_nsp2; -- failed (name conflict)
551 ERROR: statistics object "alt_stat2" already exists in schema "alt_nsp2"
552 RESET SESSION AUTHORIZATION;
553 SELECT nspname, stxname, rolname
554 FROM pg_statistic_ext s, pg_namespace n, pg_authid a
555 WHERE s.stxnamespace = n.oid AND s.stxowner = a.oid
556 AND n.nspname in ('alt_nsp1', 'alt_nsp2')
557 ORDER BY nspname, stxname;
558 nspname | stxname | rolname
559 ----------+-----------+-----------------------------
560 alt_nsp1 | alt_stat2 | regress_alter_generic_user2
561 alt_nsp1 | alt_stat3 | regress_alter_generic_user1
562 alt_nsp1 | alt_stat4 | regress_alter_generic_user2
563 alt_nsp2 | alt_stat2 | regress_alter_generic_user3
567 -- Text Search Dictionary
569 SET SESSION AUTHORIZATION regress_alter_generic_user1;
570 CREATE TEXT SEARCH DICTIONARY alt_ts_dict1 (template=simple);
571 CREATE TEXT SEARCH DICTIONARY alt_ts_dict2 (template=simple);
572 ALTER TEXT SEARCH DICTIONARY alt_ts_dict1 RENAME TO alt_ts_dict2; -- failed (name conflict)
573 ERROR: text search dictionary "alt_ts_dict2" already exists in schema "alt_nsp1"
574 ALTER TEXT SEARCH DICTIONARY alt_ts_dict1 RENAME TO alt_ts_dict3; -- OK
575 ALTER TEXT SEARCH DICTIONARY alt_ts_dict2 OWNER TO regress_alter_generic_user2; -- failed (no role membership)
576 ERROR: must be able to SET ROLE "regress_alter_generic_user2"
577 ALTER TEXT SEARCH DICTIONARY alt_ts_dict2 OWNER TO regress_alter_generic_user3; -- OK
578 ALTER TEXT SEARCH DICTIONARY alt_ts_dict2 SET SCHEMA alt_nsp2; -- OK
579 SET SESSION AUTHORIZATION regress_alter_generic_user2;
580 CREATE TEXT SEARCH DICTIONARY alt_ts_dict1 (template=simple);
581 CREATE TEXT SEARCH DICTIONARY alt_ts_dict2 (template=simple);
582 ALTER TEXT SEARCH DICTIONARY alt_ts_dict3 RENAME TO alt_ts_dict4; -- failed (not owner)
583 ERROR: must be owner of text search dictionary alt_ts_dict3
584 ALTER TEXT SEARCH DICTIONARY alt_ts_dict1 RENAME TO alt_ts_dict4; -- OK
585 ALTER TEXT SEARCH DICTIONARY alt_ts_dict3 OWNER TO regress_alter_generic_user2; -- failed (not owner)
586 ERROR: must be owner of text search dictionary alt_ts_dict3
587 ALTER TEXT SEARCH DICTIONARY alt_ts_dict2 OWNER TO regress_alter_generic_user3; -- failed (no role membership)
588 ERROR: must be able to SET ROLE "regress_alter_generic_user3"
589 ALTER TEXT SEARCH DICTIONARY alt_ts_dict3 SET SCHEMA alt_nsp2; -- failed (not owner)
590 ERROR: must be owner of text search dictionary alt_ts_dict3
591 ALTER TEXT SEARCH DICTIONARY alt_ts_dict2 SET SCHEMA alt_nsp2; -- failed (name conflict)
592 ERROR: text search dictionary "alt_ts_dict2" already exists in schema "alt_nsp2"
593 RESET SESSION AUTHORIZATION;
594 SELECT nspname, dictname, rolname
595 FROM pg_ts_dict t, pg_namespace n, pg_authid a
596 WHERE t.dictnamespace = n.oid AND t.dictowner = a.oid
597 AND n.nspname in ('alt_nsp1', 'alt_nsp2')
598 ORDER BY nspname, dictname;
599 nspname | dictname | rolname
600 ----------+--------------+-----------------------------
601 alt_nsp1 | alt_ts_dict2 | regress_alter_generic_user2
602 alt_nsp1 | alt_ts_dict3 | regress_alter_generic_user1
603 alt_nsp1 | alt_ts_dict4 | regress_alter_generic_user2
604 alt_nsp2 | alt_ts_dict2 | regress_alter_generic_user3
608 -- Text Search Configuration
610 SET SESSION AUTHORIZATION regress_alter_generic_user1;
611 CREATE TEXT SEARCH CONFIGURATION alt_ts_conf1 (copy=english);
612 CREATE TEXT SEARCH CONFIGURATION alt_ts_conf2 (copy=english);
613 ALTER TEXT SEARCH CONFIGURATION alt_ts_conf1 RENAME TO alt_ts_conf2; -- failed (name conflict)
614 ERROR: text search configuration "alt_ts_conf2" already exists in schema "alt_nsp1"
615 ALTER TEXT SEARCH CONFIGURATION alt_ts_conf1 RENAME TO alt_ts_conf3; -- OK
616 ALTER TEXT SEARCH CONFIGURATION alt_ts_conf2 OWNER TO regress_alter_generic_user2; -- failed (no role membership)
617 ERROR: must be able to SET ROLE "regress_alter_generic_user2"
618 ALTER TEXT SEARCH CONFIGURATION alt_ts_conf2 OWNER TO regress_alter_generic_user3; -- OK
619 ALTER TEXT SEARCH CONFIGURATION alt_ts_conf2 SET SCHEMA alt_nsp2; -- OK
620 SET SESSION AUTHORIZATION regress_alter_generic_user2;
621 CREATE TEXT SEARCH CONFIGURATION alt_ts_conf1 (copy=english);
622 CREATE TEXT SEARCH CONFIGURATION alt_ts_conf2 (copy=english);
623 ALTER TEXT SEARCH CONFIGURATION alt_ts_conf3 RENAME TO alt_ts_conf4; -- failed (not owner)
624 ERROR: must be owner of text search configuration alt_ts_conf3
625 ALTER TEXT SEARCH CONFIGURATION alt_ts_conf1 RENAME TO alt_ts_conf4; -- OK
626 ALTER TEXT SEARCH CONFIGURATION alt_ts_conf3 OWNER TO regress_alter_generic_user2; -- failed (not owner)
627 ERROR: must be owner of text search configuration alt_ts_conf3
628 ALTER TEXT SEARCH CONFIGURATION alt_ts_conf2 OWNER TO regress_alter_generic_user3; -- failed (no role membership)
629 ERROR: must be able to SET ROLE "regress_alter_generic_user3"
630 ALTER TEXT SEARCH CONFIGURATION alt_ts_conf3 SET SCHEMA alt_nsp2; -- failed (not owner)
631 ERROR: must be owner of text search configuration alt_ts_conf3
632 ALTER TEXT SEARCH CONFIGURATION alt_ts_conf2 SET SCHEMA alt_nsp2; -- failed (name conflict)
633 ERROR: text search configuration "alt_ts_conf2" already exists in schema "alt_nsp2"
634 RESET SESSION AUTHORIZATION;
635 SELECT nspname, cfgname, rolname
636 FROM pg_ts_config t, pg_namespace n, pg_authid a
637 WHERE t.cfgnamespace = n.oid AND t.cfgowner = a.oid
638 AND n.nspname in ('alt_nsp1', 'alt_nsp2')
639 ORDER BY nspname, cfgname;
640 nspname | cfgname | rolname
641 ----------+--------------+-----------------------------
642 alt_nsp1 | alt_ts_conf2 | regress_alter_generic_user2
643 alt_nsp1 | alt_ts_conf3 | regress_alter_generic_user1
644 alt_nsp1 | alt_ts_conf4 | regress_alter_generic_user2
645 alt_nsp2 | alt_ts_conf2 | regress_alter_generic_user3
649 -- Text Search Template
651 CREATE TEXT SEARCH TEMPLATE alt_ts_temp1 (lexize=dsimple_lexize);
652 CREATE TEXT SEARCH TEMPLATE alt_ts_temp2 (lexize=dsimple_lexize);
653 ALTER TEXT SEARCH TEMPLATE alt_ts_temp1 RENAME TO alt_ts_temp2; -- failed (name conflict)
654 ERROR: text search template "alt_ts_temp2" already exists in schema "alt_nsp1"
655 ALTER TEXT SEARCH TEMPLATE alt_ts_temp1 RENAME TO alt_ts_temp3; -- OK
656 ALTER TEXT SEARCH TEMPLATE alt_ts_temp2 SET SCHEMA alt_nsp2; -- OK
657 CREATE TEXT SEARCH TEMPLATE alt_ts_temp2 (lexize=dsimple_lexize);
658 ALTER TEXT SEARCH TEMPLATE alt_ts_temp2 SET SCHEMA alt_nsp2; -- failed (name conflict)
659 ERROR: text search template "alt_ts_temp2" already exists in schema "alt_nsp2"
660 -- invalid: non-lowercase quoted identifiers
661 CREATE TEXT SEARCH TEMPLATE tstemp_case ("Init" = init_function);
662 ERROR: text search template parameter "Init" not recognized
663 SELECT nspname, tmplname
664 FROM pg_ts_template t, pg_namespace n
665 WHERE t.tmplnamespace = n.oid AND nspname like 'alt_nsp%'
666 ORDER BY nspname, tmplname;
668 ----------+--------------
669 alt_nsp1 | alt_ts_temp2
670 alt_nsp1 | alt_ts_temp3
671 alt_nsp2 | alt_ts_temp2
675 -- Text Search Parser
677 CREATE TEXT SEARCH PARSER alt_ts_prs1
678 (start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype);
679 CREATE TEXT SEARCH PARSER alt_ts_prs2
680 (start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype);
681 ALTER TEXT SEARCH PARSER alt_ts_prs1 RENAME TO alt_ts_prs2; -- failed (name conflict)
682 ERROR: text search parser "alt_ts_prs2" already exists in schema "alt_nsp1"
683 ALTER TEXT SEARCH PARSER alt_ts_prs1 RENAME TO alt_ts_prs3; -- OK
684 ALTER TEXT SEARCH PARSER alt_ts_prs2 SET SCHEMA alt_nsp2; -- OK
685 CREATE TEXT SEARCH PARSER alt_ts_prs2
686 (start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype);
687 ALTER TEXT SEARCH PARSER alt_ts_prs2 SET SCHEMA alt_nsp2; -- failed (name conflict)
688 ERROR: text search parser "alt_ts_prs2" already exists in schema "alt_nsp2"
689 -- invalid: non-lowercase quoted identifiers
690 CREATE TEXT SEARCH PARSER tspars_case ("Start" = start_function);
691 ERROR: text search parser parameter "Start" not recognized
692 SELECT nspname, prsname
693 FROM pg_ts_parser t, pg_namespace n
694 WHERE t.prsnamespace = n.oid AND nspname like 'alt_nsp%'
695 ORDER BY nspname, prsname;
697 ----------+-------------
698 alt_nsp1 | alt_ts_prs2
699 alt_nsp1 | alt_ts_prs3
700 alt_nsp2 | alt_ts_prs2
704 --- Cleanup resources
706 DROP FOREIGN DATA WRAPPER alt_fdw2 CASCADE;
707 NOTICE: drop cascades to server alt_fserv2
708 DROP FOREIGN DATA WRAPPER alt_fdw3 CASCADE;
709 NOTICE: drop cascades to server alt_fserv3
710 DROP LANGUAGE alt_lang2 CASCADE;
711 DROP LANGUAGE alt_lang3 CASCADE;
712 DROP SCHEMA alt_nsp1 CASCADE;
713 NOTICE: drop cascades to 28 other objects
714 DETAIL: drop cascades to function alt_func3(integer)
715 drop cascades to function alt_agg3(integer)
716 drop cascades to function alt_func4(integer)
717 drop cascades to function alt_func2(integer)
718 drop cascades to function alt_agg4(integer)
719 drop cascades to function alt_agg2(integer)
720 drop cascades to conversion alt_conv3
721 drop cascades to conversion alt_conv4
722 drop cascades to conversion alt_conv2
723 drop cascades to operator @+@(integer,integer)
724 drop cascades to operator @-@(integer,integer)
725 drop cascades to operator family alt_opf3 for access method hash
726 drop cascades to operator family alt_opc1 for access method hash
727 drop cascades to operator family alt_opc2 for access method hash
728 drop cascades to operator family alt_opf4 for access method hash
729 drop cascades to operator family alt_opf2 for access method hash
730 drop cascades to table alt_regress_1
731 drop cascades to table alt_regress_2
732 drop cascades to text search dictionary alt_ts_dict3
733 drop cascades to text search dictionary alt_ts_dict4
734 drop cascades to text search dictionary alt_ts_dict2
735 drop cascades to text search configuration alt_ts_conf3
736 drop cascades to text search configuration alt_ts_conf4
737 drop cascades to text search configuration alt_ts_conf2
738 drop cascades to text search template alt_ts_temp3
739 drop cascades to text search template alt_ts_temp2
740 drop cascades to text search parser alt_ts_prs3
741 drop cascades to text search parser alt_ts_prs2
742 DROP SCHEMA alt_nsp2 CASCADE;
743 NOTICE: drop cascades to 9 other objects
744 DETAIL: drop cascades to function alt_nsp2.alt_func2(integer)
745 drop cascades to function alt_nsp2.alt_agg2(integer)
746 drop cascades to conversion alt_nsp2.alt_conv2
747 drop cascades to operator alt_nsp2.@-@(integer,integer)
748 drop cascades to operator family alt_nsp2.alt_opf2 for access method hash
749 drop cascades to text search dictionary alt_nsp2.alt_ts_dict2
750 drop cascades to text search configuration alt_nsp2.alt_ts_conf2
751 drop cascades to text search template alt_nsp2.alt_ts_temp2
752 drop cascades to text search parser alt_nsp2.alt_ts_prs2
753 DROP USER regress_alter_generic_user1;
754 DROP USER regress_alter_generic_user2;
755 DROP USER regress_alter_generic_user3;