2 -- Test for pg_get_object_address
4 -- Clean up in case a prior regression run failed
5 SET client_min_messages TO 'warning';
6 DROP ROLE IF EXISTS regress_addr_user;
7 RESET client_min_messages;
8 CREATE USER regress_addr_user;
9 -- Test generic object addressing/identification functions
10 CREATE SCHEMA addr_nsp;
11 SET search_path TO 'addr_nsp';
12 CREATE FOREIGN DATA WRAPPER addr_fdw;
13 CREATE SERVER addr_fserv FOREIGN DATA WRAPPER addr_fdw;
14 CREATE TEXT SEARCH DICTIONARY addr_ts_dict (template=simple);
15 CREATE TEXT SEARCH CONFIGURATION addr_ts_conf (copy=english);
16 CREATE TEXT SEARCH TEMPLATE addr_ts_temp (lexize=dsimple_lexize);
17 CREATE TEXT SEARCH PARSER addr_ts_prs
18 (start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype);
19 CREATE TABLE addr_nsp.gentable (
20 a serial primary key CONSTRAINT a_chk CHECK (a > 0),
21 b text DEFAULT 'hello'
23 CREATE TABLE addr_nsp.parttable (
25 ) PARTITION BY RANGE (a);
26 CREATE VIEW addr_nsp.genview AS SELECT * from addr_nsp.gentable;
27 CREATE MATERIALIZED VIEW addr_nsp.genmatview AS SELECT * FROM addr_nsp.gentable;
28 CREATE TYPE addr_nsp.gencomptype AS (a int);
29 CREATE TYPE addr_nsp.genenum AS ENUM ('one', 'two');
30 CREATE FOREIGN TABLE addr_nsp.genftable (a int) SERVER addr_fserv;
31 CREATE AGGREGATE addr_nsp.genaggr(int4) (sfunc = int4pl, stype = int4);
32 CREATE DOMAIN addr_nsp.gendomain AS int4 CONSTRAINT domconstr CHECK (value > 0);
33 CREATE FUNCTION addr_nsp.trig() RETURNS TRIGGER LANGUAGE plpgsql AS $$ BEGIN END; $$;
34 CREATE TRIGGER t BEFORE INSERT ON addr_nsp.gentable FOR EACH ROW EXECUTE PROCEDURE addr_nsp.trig();
35 CREATE POLICY genpol ON addr_nsp.gentable;
36 CREATE PROCEDURE addr_nsp.proc(int4) LANGUAGE SQL AS $$ $$;
37 CREATE SERVER "integer" FOREIGN DATA WRAPPER addr_fdw;
38 CREATE USER MAPPING FOR regress_addr_user SERVER "integer";
39 ALTER DEFAULT PRIVILEGES FOR ROLE regress_addr_user IN SCHEMA public GRANT ALL ON TABLES TO regress_addr_user;
40 ALTER DEFAULT PRIVILEGES FOR ROLE regress_addr_user REVOKE DELETE ON TABLES FROM regress_addr_user;
41 -- this transform would be quite unsafe to leave lying around,
42 -- except that the SQL language pays no attention to transforms:
43 CREATE TRANSFORM FOR int LANGUAGE SQL (
44 FROM SQL WITH FUNCTION prsd_lextype(internal),
45 TO SQL WITH FUNCTION int4recv(internal));
46 -- suppress warning that depends on wal_level
47 SET client_min_messages = 'ERROR';
48 CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable;
49 CREATE PUBLICATION addr_pub_schema FOR TABLES IN SCHEMA addr_nsp;
50 RESET client_min_messages;
51 CREATE SUBSCRIPTION regress_addr_sub CONNECTION '' PUBLICATION bar WITH (connect = false, slot_name = NONE);
52 WARNING: subscription was created, but is not connected
53 HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
54 CREATE STATISTICS addr_nsp.gentable_stat ON a, b FROM addr_nsp.gentable;
55 -- test some error cases
56 SELECT pg_get_object_address('stone', '{}', '{}');
57 ERROR: unrecognized object type "stone"
58 SELECT pg_get_object_address('table', '{}', '{}');
59 ERROR: name list length must be at least 1
60 SELECT pg_get_object_address('table', '{NULL}', '{}');
61 ERROR: name or argument lists may not contain nulls
62 -- unrecognized object types
67 FOR objtype IN VALUES ('toast table'), ('index column'), ('sequence column'),
68 ('toast table column'), ('view column'), ('materialized view column')
71 PERFORM pg_get_object_address(objtype, '{one}', '{}');
72 EXCEPTION WHEN invalid_parameter_value THEN
73 RAISE WARNING 'error for %: %', objtype, sqlerrm;
78 WARNING: error for toast table: unsupported object type "toast table"
79 WARNING: error for index column: unsupported object type "index column"
80 WARNING: error for sequence column: unsupported object type "sequence column"
81 WARNING: error for toast table column: unsupported object type "toast table column"
82 WARNING: error for view column: unsupported object type "view column"
83 WARNING: error for materialized view column: unsupported object type "materialized view column"
84 -- miscellaneous other errors
85 select * from pg_get_object_address('operator of access method', '{btree,integer_ops,1}', '{int4,bool}');
86 ERROR: operator 1 (int4, bool) of operator family integer_ops for access method btree does not exist
87 select * from pg_get_object_address('operator of access method', '{btree,integer_ops,99}', '{int4,int4}');
88 ERROR: operator 99 (int4, int4) of operator family integer_ops for access method btree does not exist
89 select * from pg_get_object_address('function of access method', '{btree,integer_ops,1}', '{int4,bool}');
90 ERROR: function 1 (int4, bool) of operator family integer_ops for access method btree does not exist
91 select * from pg_get_object_address('function of access method', '{btree,integer_ops,99}', '{int4,int4}');
92 ERROR: function 99 (int4, int4) of operator family integer_ops for access method btree does not exist
100 ('table'), ('index'), ('sequence'), ('view'),
101 ('materialized view'), ('foreign table'),
102 ('table column'), ('foreign table column'),
103 ('aggregate'), ('function'), ('procedure'), ('type'), ('cast'),
104 ('table constraint'), ('domain constraint'), ('conversion'), ('default value'),
105 ('operator'), ('operator class'), ('operator family'), ('rule'), ('trigger'),
106 ('text search parser'), ('text search dictionary'),
107 ('text search template'), ('text search configuration'),
108 ('policy'), ('user mapping'), ('default acl'), ('transform'),
109 ('operator of access method'), ('function of access method'),
110 ('publication namespace'), ('publication relation')
112 FOR names IN VALUES ('{eins}'), ('{addr_nsp, zwei}'), ('{eins, zwei, drei}')
114 FOR args IN VALUES ('{}'), ('{integer}')
117 PERFORM pg_get_object_address(objtype, names, args);
118 EXCEPTION WHEN OTHERS THEN
119 RAISE WARNING 'error for %,%,%: %', objtype, names, args, sqlerrm;
126 WARNING: error for table,{eins},{}: relation "eins" does not exist
127 WARNING: error for table,{eins},{integer}: relation "eins" does not exist
128 WARNING: error for table,{addr_nsp,zwei},{}: relation "addr_nsp.zwei" does not exist
129 WARNING: error for table,{addr_nsp,zwei},{integer}: relation "addr_nsp.zwei" does not exist
130 WARNING: error for table,{eins,zwei,drei},{}: cross-database references are not implemented: "eins.zwei.drei"
131 WARNING: error for table,{eins,zwei,drei},{integer}: cross-database references are not implemented: "eins.zwei.drei"
132 WARNING: error for index,{eins},{}: relation "eins" does not exist
133 WARNING: error for index,{eins},{integer}: relation "eins" does not exist
134 WARNING: error for index,{addr_nsp,zwei},{}: relation "addr_nsp.zwei" does not exist
135 WARNING: error for index,{addr_nsp,zwei},{integer}: relation "addr_nsp.zwei" does not exist
136 WARNING: error for index,{eins,zwei,drei},{}: cross-database references are not implemented: "eins.zwei.drei"
137 WARNING: error for index,{eins,zwei,drei},{integer}: cross-database references are not implemented: "eins.zwei.drei"
138 WARNING: error for sequence,{eins},{}: relation "eins" does not exist
139 WARNING: error for sequence,{eins},{integer}: relation "eins" does not exist
140 WARNING: error for sequence,{addr_nsp,zwei},{}: relation "addr_nsp.zwei" does not exist
141 WARNING: error for sequence,{addr_nsp,zwei},{integer}: relation "addr_nsp.zwei" does not exist
142 WARNING: error for sequence,{eins,zwei,drei},{}: cross-database references are not implemented: "eins.zwei.drei"
143 WARNING: error for sequence,{eins,zwei,drei},{integer}: cross-database references are not implemented: "eins.zwei.drei"
144 WARNING: error for view,{eins},{}: relation "eins" does not exist
145 WARNING: error for view,{eins},{integer}: relation "eins" does not exist
146 WARNING: error for view,{addr_nsp,zwei},{}: relation "addr_nsp.zwei" does not exist
147 WARNING: error for view,{addr_nsp,zwei},{integer}: relation "addr_nsp.zwei" does not exist
148 WARNING: error for view,{eins,zwei,drei},{}: cross-database references are not implemented: "eins.zwei.drei"
149 WARNING: error for view,{eins,zwei,drei},{integer}: cross-database references are not implemented: "eins.zwei.drei"
150 WARNING: error for materialized view,{eins},{}: relation "eins" does not exist
151 WARNING: error for materialized view,{eins},{integer}: relation "eins" does not exist
152 WARNING: error for materialized view,{addr_nsp,zwei},{}: relation "addr_nsp.zwei" does not exist
153 WARNING: error for materialized view,{addr_nsp,zwei},{integer}: relation "addr_nsp.zwei" does not exist
154 WARNING: error for materialized view,{eins,zwei,drei},{}: cross-database references are not implemented: "eins.zwei.drei"
155 WARNING: error for materialized view,{eins,zwei,drei},{integer}: cross-database references are not implemented: "eins.zwei.drei"
156 WARNING: error for foreign table,{eins},{}: relation "eins" does not exist
157 WARNING: error for foreign table,{eins},{integer}: relation "eins" does not exist
158 WARNING: error for foreign table,{addr_nsp,zwei},{}: relation "addr_nsp.zwei" does not exist
159 WARNING: error for foreign table,{addr_nsp,zwei},{integer}: relation "addr_nsp.zwei" does not exist
160 WARNING: error for foreign table,{eins,zwei,drei},{}: cross-database references are not implemented: "eins.zwei.drei"
161 WARNING: error for foreign table,{eins,zwei,drei},{integer}: cross-database references are not implemented: "eins.zwei.drei"
162 WARNING: error for table column,{eins},{}: column name must be qualified
163 WARNING: error for table column,{eins},{integer}: column name must be qualified
164 WARNING: error for table column,{addr_nsp,zwei},{}: relation "addr_nsp" does not exist
165 WARNING: error for table column,{addr_nsp,zwei},{integer}: relation "addr_nsp" does not exist
166 WARNING: error for table column,{eins,zwei,drei},{}: schema "eins" does not exist
167 WARNING: error for table column,{eins,zwei,drei},{integer}: schema "eins" does not exist
168 WARNING: error for foreign table column,{eins},{}: column name must be qualified
169 WARNING: error for foreign table column,{eins},{integer}: column name must be qualified
170 WARNING: error for foreign table column,{addr_nsp,zwei},{}: relation "addr_nsp" does not exist
171 WARNING: error for foreign table column,{addr_nsp,zwei},{integer}: relation "addr_nsp" does not exist
172 WARNING: error for foreign table column,{eins,zwei,drei},{}: schema "eins" does not exist
173 WARNING: error for foreign table column,{eins,zwei,drei},{integer}: schema "eins" does not exist
174 WARNING: error for aggregate,{eins},{}: aggregate eins(*) does not exist
175 WARNING: error for aggregate,{eins},{integer}: aggregate eins(integer) does not exist
176 WARNING: error for aggregate,{addr_nsp,zwei},{}: aggregate addr_nsp.zwei(*) does not exist
177 WARNING: error for aggregate,{addr_nsp,zwei},{integer}: aggregate addr_nsp.zwei(integer) does not exist
178 WARNING: error for aggregate,{eins,zwei,drei},{}: cross-database references are not implemented: eins.zwei.drei
179 WARNING: error for aggregate,{eins,zwei,drei},{integer}: cross-database references are not implemented: eins.zwei.drei
180 WARNING: error for function,{eins},{}: function eins() does not exist
181 WARNING: error for function,{eins},{integer}: function eins(integer) does not exist
182 WARNING: error for function,{addr_nsp,zwei},{}: function addr_nsp.zwei() does not exist
183 WARNING: error for function,{addr_nsp,zwei},{integer}: function addr_nsp.zwei(integer) does not exist
184 WARNING: error for function,{eins,zwei,drei},{}: cross-database references are not implemented: eins.zwei.drei
185 WARNING: error for function,{eins,zwei,drei},{integer}: cross-database references are not implemented: eins.zwei.drei
186 WARNING: error for procedure,{eins},{}: procedure eins() does not exist
187 WARNING: error for procedure,{eins},{integer}: procedure eins(integer) does not exist
188 WARNING: error for procedure,{addr_nsp,zwei},{}: procedure addr_nsp.zwei() does not exist
189 WARNING: error for procedure,{addr_nsp,zwei},{integer}: procedure addr_nsp.zwei(integer) does not exist
190 WARNING: error for procedure,{eins,zwei,drei},{}: cross-database references are not implemented: eins.zwei.drei
191 WARNING: error for procedure,{eins,zwei,drei},{integer}: cross-database references are not implemented: eins.zwei.drei
192 WARNING: error for type,{eins},{}: type "eins" does not exist
193 WARNING: error for type,{eins},{integer}: type "eins" does not exist
194 WARNING: error for type,{addr_nsp,zwei},{}: name list length must be exactly 1
195 WARNING: error for type,{addr_nsp,zwei},{integer}: name list length must be exactly 1
196 WARNING: error for type,{eins,zwei,drei},{}: name list length must be exactly 1
197 WARNING: error for type,{eins,zwei,drei},{integer}: name list length must be exactly 1
198 WARNING: error for cast,{eins},{}: argument list length must be exactly 1
199 WARNING: error for cast,{eins},{integer}: type "eins" does not exist
200 WARNING: error for cast,{addr_nsp,zwei},{}: name list length must be exactly 1
201 WARNING: error for cast,{addr_nsp,zwei},{integer}: name list length must be exactly 1
202 WARNING: error for cast,{eins,zwei,drei},{}: name list length must be exactly 1
203 WARNING: error for cast,{eins,zwei,drei},{integer}: name list length must be exactly 1
204 WARNING: error for table constraint,{eins},{}: must specify relation and object name
205 WARNING: error for table constraint,{eins},{integer}: must specify relation and object name
206 WARNING: error for table constraint,{addr_nsp,zwei},{}: relation "addr_nsp" does not exist
207 WARNING: error for table constraint,{addr_nsp,zwei},{integer}: relation "addr_nsp" does not exist
208 WARNING: error for table constraint,{eins,zwei,drei},{}: schema "eins" does not exist
209 WARNING: error for table constraint,{eins,zwei,drei},{integer}: schema "eins" does not exist
210 WARNING: error for domain constraint,{eins},{}: argument list length must be exactly 1
211 WARNING: error for domain constraint,{eins},{integer}: type "eins" does not exist
212 WARNING: error for domain constraint,{addr_nsp,zwei},{}: name list length must be exactly 1
213 WARNING: error for domain constraint,{addr_nsp,zwei},{integer}: name list length must be exactly 1
214 WARNING: error for domain constraint,{eins,zwei,drei},{}: name list length must be exactly 1
215 WARNING: error for domain constraint,{eins,zwei,drei},{integer}: name list length must be exactly 1
216 WARNING: error for conversion,{eins},{}: conversion "eins" does not exist
217 WARNING: error for conversion,{eins},{integer}: conversion "eins" does not exist
218 WARNING: error for conversion,{addr_nsp,zwei},{}: conversion "addr_nsp.zwei" does not exist
219 WARNING: error for conversion,{addr_nsp,zwei},{integer}: conversion "addr_nsp.zwei" does not exist
220 WARNING: error for conversion,{eins,zwei,drei},{}: cross-database references are not implemented: eins.zwei.drei
221 WARNING: error for conversion,{eins,zwei,drei},{integer}: cross-database references are not implemented: eins.zwei.drei
222 WARNING: error for default value,{eins},{}: column name must be qualified
223 WARNING: error for default value,{eins},{integer}: column name must be qualified
224 WARNING: error for default value,{addr_nsp,zwei},{}: relation "addr_nsp" does not exist
225 WARNING: error for default value,{addr_nsp,zwei},{integer}: relation "addr_nsp" does not exist
226 WARNING: error for default value,{eins,zwei,drei},{}: schema "eins" does not exist
227 WARNING: error for default value,{eins,zwei,drei},{integer}: schema "eins" does not exist
228 WARNING: error for operator,{eins},{}: argument list length must be exactly 2
229 WARNING: error for operator,{eins},{integer}: argument list length must be exactly 2
230 WARNING: error for operator,{addr_nsp,zwei},{}: argument list length must be exactly 2
231 WARNING: error for operator,{addr_nsp,zwei},{integer}: argument list length must be exactly 2
232 WARNING: error for operator,{eins,zwei,drei},{}: argument list length must be exactly 2
233 WARNING: error for operator,{eins,zwei,drei},{integer}: argument list length must be exactly 2
234 WARNING: error for operator class,{eins},{}: name list length must be at least 2
235 WARNING: error for operator class,{eins},{integer}: name list length must be at least 2
236 WARNING: error for operator class,{addr_nsp,zwei},{}: access method "addr_nsp" does not exist
237 WARNING: error for operator class,{addr_nsp,zwei},{integer}: access method "addr_nsp" does not exist
238 WARNING: error for operator class,{eins,zwei,drei},{}: access method "eins" does not exist
239 WARNING: error for operator class,{eins,zwei,drei},{integer}: access method "eins" does not exist
240 WARNING: error for operator family,{eins},{}: name list length must be at least 2
241 WARNING: error for operator family,{eins},{integer}: name list length must be at least 2
242 WARNING: error for operator family,{addr_nsp,zwei},{}: access method "addr_nsp" does not exist
243 WARNING: error for operator family,{addr_nsp,zwei},{integer}: access method "addr_nsp" does not exist
244 WARNING: error for operator family,{eins,zwei,drei},{}: access method "eins" does not exist
245 WARNING: error for operator family,{eins,zwei,drei},{integer}: access method "eins" does not exist
246 WARNING: error for rule,{eins},{}: must specify relation and object name
247 WARNING: error for rule,{eins},{integer}: must specify relation and object name
248 WARNING: error for rule,{addr_nsp,zwei},{}: relation "addr_nsp" does not exist
249 WARNING: error for rule,{addr_nsp,zwei},{integer}: relation "addr_nsp" does not exist
250 WARNING: error for rule,{eins,zwei,drei},{}: schema "eins" does not exist
251 WARNING: error for rule,{eins,zwei,drei},{integer}: schema "eins" does not exist
252 WARNING: error for trigger,{eins},{}: must specify relation and object name
253 WARNING: error for trigger,{eins},{integer}: must specify relation and object name
254 WARNING: error for trigger,{addr_nsp,zwei},{}: relation "addr_nsp" does not exist
255 WARNING: error for trigger,{addr_nsp,zwei},{integer}: relation "addr_nsp" does not exist
256 WARNING: error for trigger,{eins,zwei,drei},{}: schema "eins" does not exist
257 WARNING: error for trigger,{eins,zwei,drei},{integer}: schema "eins" does not exist
258 WARNING: error for text search parser,{eins},{}: text search parser "eins" does not exist
259 WARNING: error for text search parser,{eins},{integer}: text search parser "eins" does not exist
260 WARNING: error for text search parser,{addr_nsp,zwei},{}: text search parser "addr_nsp.zwei" does not exist
261 WARNING: error for text search parser,{addr_nsp,zwei},{integer}: text search parser "addr_nsp.zwei" does not exist
262 WARNING: error for text search parser,{eins,zwei,drei},{}: cross-database references are not implemented: eins.zwei.drei
263 WARNING: error for text search parser,{eins,zwei,drei},{integer}: cross-database references are not implemented: eins.zwei.drei
264 WARNING: error for text search dictionary,{eins},{}: text search dictionary "eins" does not exist
265 WARNING: error for text search dictionary,{eins},{integer}: text search dictionary "eins" does not exist
266 WARNING: error for text search dictionary,{addr_nsp,zwei},{}: text search dictionary "addr_nsp.zwei" does not exist
267 WARNING: error for text search dictionary,{addr_nsp,zwei},{integer}: text search dictionary "addr_nsp.zwei" does not exist
268 WARNING: error for text search dictionary,{eins,zwei,drei},{}: cross-database references are not implemented: eins.zwei.drei
269 WARNING: error for text search dictionary,{eins,zwei,drei},{integer}: cross-database references are not implemented: eins.zwei.drei
270 WARNING: error for text search template,{eins},{}: text search template "eins" does not exist
271 WARNING: error for text search template,{eins},{integer}: text search template "eins" does not exist
272 WARNING: error for text search template,{addr_nsp,zwei},{}: text search template "addr_nsp.zwei" does not exist
273 WARNING: error for text search template,{addr_nsp,zwei},{integer}: text search template "addr_nsp.zwei" does not exist
274 WARNING: error for text search template,{eins,zwei,drei},{}: cross-database references are not implemented: eins.zwei.drei
275 WARNING: error for text search template,{eins,zwei,drei},{integer}: cross-database references are not implemented: eins.zwei.drei
276 WARNING: error for text search configuration,{eins},{}: text search configuration "eins" does not exist
277 WARNING: error for text search configuration,{eins},{integer}: text search configuration "eins" does not exist
278 WARNING: error for text search configuration,{addr_nsp,zwei},{}: text search configuration "addr_nsp.zwei" does not exist
279 WARNING: error for text search configuration,{addr_nsp,zwei},{integer}: text search configuration "addr_nsp.zwei" does not exist
280 WARNING: error for text search configuration,{eins,zwei,drei},{}: cross-database references are not implemented: eins.zwei.drei
281 WARNING: error for text search configuration,{eins,zwei,drei},{integer}: cross-database references are not implemented: eins.zwei.drei
282 WARNING: error for policy,{eins},{}: must specify relation and object name
283 WARNING: error for policy,{eins},{integer}: must specify relation and object name
284 WARNING: error for policy,{addr_nsp,zwei},{}: relation "addr_nsp" does not exist
285 WARNING: error for policy,{addr_nsp,zwei},{integer}: relation "addr_nsp" does not exist
286 WARNING: error for policy,{eins,zwei,drei},{}: schema "eins" does not exist
287 WARNING: error for policy,{eins,zwei,drei},{integer}: schema "eins" does not exist
288 WARNING: error for user mapping,{eins},{}: argument list length must be exactly 1
289 WARNING: error for user mapping,{eins},{integer}: user mapping for user "eins" on server "integer" does not exist
290 WARNING: error for user mapping,{addr_nsp,zwei},{}: name list length must be exactly 1
291 WARNING: error for user mapping,{addr_nsp,zwei},{integer}: name list length must be exactly 1
292 WARNING: error for user mapping,{eins,zwei,drei},{}: name list length must be exactly 1
293 WARNING: error for user mapping,{eins,zwei,drei},{integer}: name list length must be exactly 1
294 WARNING: error for default acl,{eins},{}: argument list length must be exactly 1
295 WARNING: error for default acl,{eins},{integer}: unrecognized default ACL object type "i"
296 WARNING: error for default acl,{addr_nsp,zwei},{}: argument list length must be exactly 1
297 WARNING: error for default acl,{addr_nsp,zwei},{integer}: unrecognized default ACL object type "i"
298 WARNING: error for default acl,{eins,zwei,drei},{}: argument list length must be exactly 1
299 WARNING: error for default acl,{eins,zwei,drei},{integer}: unrecognized default ACL object type "i"
300 WARNING: error for transform,{eins},{}: argument list length must be exactly 1
301 WARNING: error for transform,{eins},{integer}: type "eins" does not exist
302 WARNING: error for transform,{addr_nsp,zwei},{}: name list length must be exactly 1
303 WARNING: error for transform,{addr_nsp,zwei},{integer}: name list length must be exactly 1
304 WARNING: error for transform,{eins,zwei,drei},{}: name list length must be exactly 1
305 WARNING: error for transform,{eins,zwei,drei},{integer}: name list length must be exactly 1
306 WARNING: error for operator of access method,{eins},{}: name list length must be at least 3
307 WARNING: error for operator of access method,{eins},{integer}: name list length must be at least 3
308 WARNING: error for operator of access method,{addr_nsp,zwei},{}: name list length must be at least 3
309 WARNING: error for operator of access method,{addr_nsp,zwei},{integer}: name list length must be at least 3
310 WARNING: error for operator of access method,{eins,zwei,drei},{}: argument list length must be exactly 2
311 WARNING: error for operator of access method,{eins,zwei,drei},{integer}: argument list length must be exactly 2
312 WARNING: error for function of access method,{eins},{}: name list length must be at least 3
313 WARNING: error for function of access method,{eins},{integer}: name list length must be at least 3
314 WARNING: error for function of access method,{addr_nsp,zwei},{}: name list length must be at least 3
315 WARNING: error for function of access method,{addr_nsp,zwei},{integer}: name list length must be at least 3
316 WARNING: error for function of access method,{eins,zwei,drei},{}: argument list length must be exactly 2
317 WARNING: error for function of access method,{eins,zwei,drei},{integer}: argument list length must be exactly 2
318 WARNING: error for publication namespace,{eins},{}: argument list length must be exactly 1
319 WARNING: error for publication namespace,{eins},{integer}: schema "eins" does not exist
320 WARNING: error for publication namespace,{addr_nsp,zwei},{}: name list length must be exactly 1
321 WARNING: error for publication namespace,{addr_nsp,zwei},{integer}: name list length must be exactly 1
322 WARNING: error for publication namespace,{eins,zwei,drei},{}: name list length must be exactly 1
323 WARNING: error for publication namespace,{eins,zwei,drei},{integer}: name list length must be exactly 1
324 WARNING: error for publication relation,{eins},{}: argument list length must be exactly 1
325 WARNING: error for publication relation,{eins},{integer}: relation "eins" does not exist
326 WARNING: error for publication relation,{addr_nsp,zwei},{}: argument list length must be exactly 1
327 WARNING: error for publication relation,{addr_nsp,zwei},{integer}: relation "addr_nsp.zwei" does not exist
328 WARNING: error for publication relation,{eins,zwei,drei},{}: argument list length must be exactly 1
329 WARNING: error for publication relation,{eins,zwei,drei},{integer}: cross-database references are not implemented: "eins.zwei.drei"
330 -- these object types cannot be qualified names
331 SELECT pg_get_object_address('language', '{one}', '{}');
332 ERROR: language "one" does not exist
333 SELECT pg_get_object_address('language', '{one,two}', '{}');
334 ERROR: name list length must be exactly 1
335 SELECT pg_get_object_address('large object', '{123}', '{}');
336 ERROR: large object 123 does not exist
337 SELECT pg_get_object_address('large object', '{123,456}', '{}');
338 ERROR: name list length must be exactly 1
339 SELECT pg_get_object_address('large object', '{blargh}', '{}');
340 ERROR: invalid input syntax for type oid: "blargh"
341 SELECT pg_get_object_address('schema', '{one}', '{}');
342 ERROR: schema "one" does not exist
343 SELECT pg_get_object_address('schema', '{one,two}', '{}');
344 ERROR: name list length must be exactly 1
345 SELECT pg_get_object_address('role', '{one}', '{}');
346 ERROR: role "one" does not exist
347 SELECT pg_get_object_address('role', '{one,two}', '{}');
348 ERROR: name list length must be exactly 1
349 SELECT pg_get_object_address('database', '{one}', '{}');
350 ERROR: database "one" does not exist
351 SELECT pg_get_object_address('database', '{one,two}', '{}');
352 ERROR: name list length must be exactly 1
353 SELECT pg_get_object_address('tablespace', '{one}', '{}');
354 ERROR: tablespace "one" does not exist
355 SELECT pg_get_object_address('tablespace', '{one,two}', '{}');
356 ERROR: name list length must be exactly 1
357 SELECT pg_get_object_address('foreign-data wrapper', '{one}', '{}');
358 ERROR: foreign-data wrapper "one" does not exist
359 SELECT pg_get_object_address('foreign-data wrapper', '{one,two}', '{}');
360 ERROR: name list length must be exactly 1
361 SELECT pg_get_object_address('server', '{one}', '{}');
362 ERROR: server "one" does not exist
363 SELECT pg_get_object_address('server', '{one,two}', '{}');
364 ERROR: name list length must be exactly 1
365 SELECT pg_get_object_address('extension', '{one}', '{}');
366 ERROR: extension "one" does not exist
367 SELECT pg_get_object_address('extension', '{one,two}', '{}');
368 ERROR: name list length must be exactly 1
369 SELECT pg_get_object_address('event trigger', '{one}', '{}');
370 ERROR: event trigger "one" does not exist
371 SELECT pg_get_object_address('event trigger', '{one,two}', '{}');
372 ERROR: name list length must be exactly 1
373 SELECT pg_get_object_address('access method', '{one}', '{}');
374 ERROR: access method "one" does not exist
375 SELECT pg_get_object_address('access method', '{one,two}', '{}');
376 ERROR: name list length must be exactly 1
377 SELECT pg_get_object_address('publication', '{one}', '{}');
378 ERROR: publication "one" does not exist
379 SELECT pg_get_object_address('publication', '{one,two}', '{}');
380 ERROR: name list length must be exactly 1
381 SELECT pg_get_object_address('subscription', '{one}', '{}');
382 ERROR: subscription "one" does not exist
383 SELECT pg_get_object_address('subscription', '{one,two}', '{}');
384 ERROR: name list length must be exactly 1
385 -- Make sure that NULL handling is correct.
387 -- Temporarily disable fancy output, so as future additions never create
388 -- a large amount of diffs.
390 -- test successful cases
391 WITH objects (type, name, args) AS (VALUES
392 ('table', '{addr_nsp, gentable}'::text[], '{}'::text[]),
393 ('table', '{addr_nsp, parttable}'::text[], '{}'::text[]),
394 ('index', '{addr_nsp, gentable_pkey}', '{}'),
395 ('index', '{addr_nsp, parttable_pkey}', '{}'),
396 ('sequence', '{addr_nsp, gentable_a_seq}', '{}'),
398 ('view', '{addr_nsp, genview}', '{}'),
399 ('materialized view', '{addr_nsp, genmatview}', '{}'),
400 ('foreign table', '{addr_nsp, genftable}', '{}'),
401 ('table column', '{addr_nsp, gentable, b}', '{}'),
402 ('foreign table column', '{addr_nsp, genftable, a}', '{}'),
403 ('aggregate', '{addr_nsp, genaggr}', '{int4}'),
404 ('function', '{pg_catalog, pg_identify_object}', '{pg_catalog.oid, pg_catalog.oid, int4}'),
405 ('procedure', '{addr_nsp, proc}', '{int4}'),
406 ('type', '{pg_catalog._int4}', '{}'),
407 ('type', '{addr_nsp.gendomain}', '{}'),
408 ('type', '{addr_nsp.gencomptype}', '{}'),
409 ('type', '{addr_nsp.genenum}', '{}'),
410 ('cast', '{int8}', '{int4}'),
411 ('collation', '{default}', '{}'),
412 ('table constraint', '{addr_nsp, gentable, a_chk}', '{}'),
413 ('domain constraint', '{addr_nsp.gendomain}', '{domconstr}'),
414 ('conversion', '{pg_catalog, koi8_r_to_mic}', '{}'),
415 ('default value', '{addr_nsp, gentable, b}', '{}'),
416 ('language', '{plpgsql}', '{}'),
418 ('operator', '{+}', '{int4, int4}'),
419 ('operator class', '{btree, int4_ops}', '{}'),
420 ('operator family', '{btree, integer_ops}', '{}'),
421 ('operator of access method', '{btree,integer_ops,1}', '{integer,integer}'),
422 ('function of access method', '{btree,integer_ops,2}', '{integer,integer}'),
423 ('rule', '{addr_nsp, genview, _RETURN}', '{}'),
424 ('trigger', '{addr_nsp, gentable, t}', '{}'),
425 ('schema', '{addr_nsp}', '{}'),
426 ('text search parser', '{addr_ts_prs}', '{}'),
427 ('text search dictionary', '{addr_ts_dict}', '{}'),
428 ('text search template', '{addr_ts_temp}', '{}'),
429 ('text search configuration', '{addr_ts_conf}', '{}'),
430 ('role', '{regress_addr_user}', '{}'),
433 ('foreign-data wrapper', '{addr_fdw}', '{}'),
434 ('server', '{addr_fserv}', '{}'),
435 ('user mapping', '{regress_addr_user}', '{integer}'),
436 ('default acl', '{regress_addr_user,public}', '{r}'),
437 ('default acl', '{regress_addr_user}', '{r}'),
440 ('policy', '{addr_nsp, gentable, genpol}', '{}'),
441 ('transform', '{int}', '{sql}'),
442 ('access method', '{btree}', '{}'),
443 ('publication', '{addr_pub}', '{}'),
444 ('publication namespace', '{addr_nsp}', '{addr_pub_schema}'),
445 ('publication relation', '{addr_nsp, gentable}', '{addr_pub}'),
446 ('subscription', '{regress_addr_sub}', '{}'),
447 ('statistics object', '{addr_nsp, gentable_stat}', '{}')
449 SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)).*,
450 -- test roundtrip through pg_identify_object_as_address
451 ROW(pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)) =
452 ROW(pg_identify_object(addr2.classid, addr2.objid, addr2.objsubid)) AS roundtrip
454 pg_get_object_address(type, name, args) AS addr1,
455 pg_identify_object_as_address(classid, objid, objsubid) AS ioa (typ, nms, args),
456 pg_get_object_address(typ, nms, ioa.args) AS addr2
457 ORDER BY addr1.classid, addr1.objid, addr1.objsubid;
458 default acl|NULL|NULL|for role regress_addr_user in schema public on tables|t
459 default acl|NULL|NULL|for role regress_addr_user on tables|t
460 type|pg_catalog|_int4|integer[]|t
461 type|addr_nsp|gencomptype|addr_nsp.gencomptype|t
462 type|addr_nsp|genenum|addr_nsp.genenum|t
463 type|addr_nsp|gendomain|addr_nsp.gendomain|t
464 function|pg_catalog|NULL|pg_catalog.pg_identify_object(pg_catalog.oid,pg_catalog.oid,integer)|t
465 aggregate|addr_nsp|NULL|addr_nsp.genaggr(integer)|t
466 procedure|addr_nsp|NULL|addr_nsp.proc(integer)|t
467 sequence|addr_nsp|gentable_a_seq|addr_nsp.gentable_a_seq|t
468 table|addr_nsp|gentable|addr_nsp.gentable|t
469 table column|addr_nsp|gentable|addr_nsp.gentable.b|t
470 index|addr_nsp|gentable_pkey|addr_nsp.gentable_pkey|t
471 table|addr_nsp|parttable|addr_nsp.parttable|t
472 index|addr_nsp|parttable_pkey|addr_nsp.parttable_pkey|t
473 view|addr_nsp|genview|addr_nsp.genview|t
474 materialized view|addr_nsp|genmatview|addr_nsp.genmatview|t
475 foreign table|addr_nsp|genftable|addr_nsp.genftable|t
476 foreign table column|addr_nsp|genftable|addr_nsp.genftable.a|t
477 role|NULL|regress_addr_user|regress_addr_user|t
478 server|NULL|addr_fserv|addr_fserv|t
479 user mapping|NULL|NULL|regress_addr_user on server integer|t
480 foreign-data wrapper|NULL|addr_fdw|addr_fdw|t
481 access method|NULL|btree|btree|t
482 operator of access method|NULL|NULL|operator 1 (integer, integer) of pg_catalog.integer_ops USING btree|t
483 function of access method|NULL|NULL|function 2 (integer, integer) of pg_catalog.integer_ops USING btree|t
484 default value|NULL|NULL|for addr_nsp.gentable.b|t
485 cast|NULL|NULL|(bigint AS integer)|t
486 table constraint|addr_nsp|NULL|a_chk on addr_nsp.gentable|t
487 domain constraint|addr_nsp|NULL|domconstr on addr_nsp.gendomain|t
488 conversion|pg_catalog|koi8_r_to_mic|pg_catalog.koi8_r_to_mic|t
489 language|NULL|plpgsql|plpgsql|t
490 schema|NULL|addr_nsp|addr_nsp|t
491 operator class|pg_catalog|int4_ops|pg_catalog.int4_ops USING btree|t
492 operator|pg_catalog|NULL|pg_catalog.+(integer,integer)|t
493 rule|NULL|NULL|"_RETURN" on addr_nsp.genview|t
494 trigger|NULL|NULL|t on addr_nsp.gentable|t
495 operator family|pg_catalog|integer_ops|pg_catalog.integer_ops USING btree|t
496 policy|NULL|NULL|genpol on addr_nsp.gentable|t
497 statistics object|addr_nsp|gentable_stat|addr_nsp.gentable_stat|t
498 collation|pg_catalog|"default"|pg_catalog."default"|t
499 transform|NULL|NULL|for integer language sql|t
500 text search dictionary|addr_nsp|addr_ts_dict|addr_nsp.addr_ts_dict|t
501 text search parser|addr_nsp|addr_ts_prs|addr_nsp.addr_ts_prs|t
502 text search configuration|addr_nsp|addr_ts_conf|addr_nsp.addr_ts_conf|t
503 text search template|addr_nsp|addr_ts_temp|addr_nsp.addr_ts_temp|t
504 subscription|NULL|regress_addr_sub|regress_addr_sub|t
505 publication|NULL|addr_pub|addr_pub|t
506 publication relation|NULL|NULL|addr_nsp.gentable in publication addr_pub|t
507 publication namespace|NULL|NULL|addr_nsp in publication addr_pub_schema|t
509 --- Cleanup resources
511 DROP FOREIGN DATA WRAPPER addr_fdw CASCADE;
512 NOTICE: drop cascades to 4 other objects
513 DETAIL: drop cascades to server addr_fserv
514 drop cascades to foreign table genftable
515 drop cascades to server integer
516 drop cascades to user mapping for regress_addr_user on server integer
517 DROP PUBLICATION addr_pub;
518 DROP PUBLICATION addr_pub_schema;
519 DROP SUBSCRIPTION regress_addr_sub;
520 DROP SCHEMA addr_nsp CASCADE;
521 NOTICE: drop cascades to 14 other objects
522 DETAIL: drop cascades to text search dictionary addr_ts_dict
523 drop cascades to text search configuration addr_ts_conf
524 drop cascades to text search template addr_ts_temp
525 drop cascades to text search parser addr_ts_prs
526 drop cascades to table gentable
527 drop cascades to table parttable
528 drop cascades to view genview
529 drop cascades to materialized view genmatview
530 drop cascades to type gencomptype
531 drop cascades to type genenum
532 drop cascades to function genaggr(integer)
533 drop cascades to type gendomain
534 drop cascades to function trig()
535 drop cascades to function proc(integer)
536 DROP OWNED BY regress_addr_user;
537 DROP USER regress_addr_user;
539 -- Checks for invalid objects
541 -- Keep this list in the same order as getObjectIdentityParts()
542 -- in objectaddress.c.
543 WITH objects (classid, objid, objsubid) AS (VALUES
544 ('pg_class'::regclass, 0, 0), -- no relation
545 ('pg_class'::regclass, 'pg_class'::regclass, 100), -- no column for relation
546 ('pg_proc'::regclass, 0, 0), -- no function
547 ('pg_type'::regclass, 0, 0), -- no type
548 ('pg_cast'::regclass, 0, 0), -- no cast
549 ('pg_collation'::regclass, 0, 0), -- no collation
550 ('pg_constraint'::regclass, 0, 0), -- no constraint
551 ('pg_conversion'::regclass, 0, 0), -- no conversion
552 ('pg_attrdef'::regclass, 0, 0), -- no default attribute
553 ('pg_language'::regclass, 0, 0), -- no language
554 ('pg_largeobject'::regclass, 0, 0), -- no large object, no error
555 ('pg_operator'::regclass, 0, 0), -- no operator
556 ('pg_opclass'::regclass, 0, 0), -- no opclass, no need to check for no access method
557 ('pg_opfamily'::regclass, 0, 0), -- no opfamily
558 ('pg_am'::regclass, 0, 0), -- no access method
559 ('pg_amop'::regclass, 0, 0), -- no AM operator
560 ('pg_amproc'::regclass, 0, 0), -- no AM proc
561 ('pg_rewrite'::regclass, 0, 0), -- no rewrite
562 ('pg_trigger'::regclass, 0, 0), -- no trigger
563 ('pg_namespace'::regclass, 0, 0), -- no schema
564 ('pg_statistic_ext'::regclass, 0, 0), -- no statistics
565 ('pg_ts_parser'::regclass, 0, 0), -- no TS parser
566 ('pg_ts_dict'::regclass, 0, 0), -- no TS dictionary
567 ('pg_ts_template'::regclass, 0, 0), -- no TS template
568 ('pg_ts_config'::regclass, 0, 0), -- no TS configuration
569 ('pg_authid'::regclass, 0, 0), -- no role
570 ('pg_auth_members'::regclass, 0, 0), -- no role membership
571 ('pg_database'::regclass, 0, 0), -- no database
572 ('pg_tablespace'::regclass, 0, 0), -- no tablespace
573 ('pg_foreign_data_wrapper'::regclass, 0, 0), -- no FDW
574 ('pg_foreign_server'::regclass, 0, 0), -- no server
575 ('pg_user_mapping'::regclass, 0, 0), -- no user mapping
576 ('pg_default_acl'::regclass, 0, 0), -- no default ACL
577 ('pg_extension'::regclass, 0, 0), -- no extension
578 ('pg_event_trigger'::regclass, 0, 0), -- no event trigger
579 ('pg_parameter_acl'::regclass, 0, 0), -- no parameter ACL
580 ('pg_policy'::regclass, 0, 0), -- no policy
581 ('pg_publication'::regclass, 0, 0), -- no publication
582 ('pg_publication_namespace'::regclass, 0, 0), -- no publication namespace
583 ('pg_publication_rel'::regclass, 0, 0), -- no publication relation
584 ('pg_subscription'::regclass, 0, 0), -- no subscription
585 ('pg_transform'::regclass, 0, 0) -- no transformation
587 SELECT ROW(pg_identify_object(objects.classid, objects.objid, objects.objsubid))
589 ROW(pg_identify_object_as_address(objects.classid, objects.objid, objects.objsubid))
591 pg_describe_object(objects.classid, objects.objid, objects.objsubid)
594 ORDER BY objects.classid, objects.objid, objects.objsubid;
595 ("(""default acl"",,,)")|("(""default acl"",,)")|NULL
596 ("(tablespace,,,)")|("(tablespace,,)")|NULL
597 ("(type,,,)")|("(type,,)")|NULL
598 ("(routine,,,)")|("(routine,,)")|NULL
599 ("(relation,,,)")|("(relation,,)")|NULL
600 ("(""table column"",,,)")|("(""table column"",,)")|NULL
601 ("(role,,,)")|("(role,,)")|NULL
602 ("(""role membership"",,,)")|("(""role membership"",,)")|NULL
603 ("(database,,,)")|("(database,,)")|NULL
604 ("(server,,,)")|("(server,,)")|NULL
605 ("(""user mapping"",,,)")|("(""user mapping"",,)")|NULL
606 ("(""foreign-data wrapper"",,,)")|("(""foreign-data wrapper"",,)")|NULL
607 ("(""access method"",,,)")|("(""access method"",,)")|NULL
608 ("(""operator of access method"",,,)")|("(""operator of access method"",,)")|NULL
609 ("(""function of access method"",,,)")|("(""function of access method"",,)")|NULL
610 ("(""default value"",,,)")|("(""default value"",,)")|NULL
611 ("(cast,,,)")|("(cast,,)")|NULL
612 ("(constraint,,,)")|("(constraint,,)")|NULL
613 ("(conversion,,,)")|("(conversion,,)")|NULL
614 ("(language,,,)")|("(language,,)")|NULL
615 ("(""large object"",,,)")|("(""large object"",,)")|NULL
616 ("(schema,,,)")|("(schema,,)")|NULL
617 ("(""operator class"",,,)")|("(""operator class"",,)")|NULL
618 ("(operator,,,)")|("(operator,,)")|NULL
619 ("(rule,,,)")|("(rule,,)")|NULL
620 ("(trigger,,,)")|("(trigger,,)")|NULL
621 ("(""operator family"",,,)")|("(""operator family"",,)")|NULL
622 ("(extension,,,)")|("(extension,,)")|NULL
623 ("(policy,,,)")|("(policy,,)")|NULL
624 ("(""statistics object"",,,)")|("(""statistics object"",,)")|NULL
625 ("(collation,,,)")|("(collation,,)")|NULL
626 ("(""event trigger"",,,)")|("(""event trigger"",,)")|NULL
627 ("(transform,,,)")|("(transform,,)")|NULL
628 ("(""text search dictionary"",,,)")|("(""text search dictionary"",,)")|NULL
629 ("(""text search parser"",,,)")|("(""text search parser"",,)")|NULL
630 ("(""text search configuration"",,,)")|("(""text search configuration"",,)")|NULL
631 ("(""text search template"",,,)")|("(""text search template"",,)")|NULL
632 ("(subscription,,,)")|("(subscription,,)")|NULL
633 ("(publication,,,)")|("(publication,,)")|NULL
634 ("(""publication relation"",,,)")|("(""publication relation"",,)")|NULL
635 ("(""publication namespace"",,,)")|("(""publication namespace"",,)")|NULL
636 ("(""parameter ACL"",,,)")|("(""parameter ACL"",,)")|NULL
637 -- restore normal output mode