4 /* If objects exist, return oids */
5 CREATE ROLE regress_regrole_test;
13 SELECT regoperator('+(int4,int4)');
19 SELECT regproc('now');
25 SELECT regprocedure('abs(numeric)');
31 SELECT regclass('pg_class');
37 SELECT regtype('int4');
43 SELECT regcollation('"POSIX"');
49 SELECT to_regoper('||/');
55 SELECT to_regoperator('+(int4,int4)');
61 SELECT to_regproc('now');
67 SELECT to_regprocedure('abs(numeric)');
73 SELECT to_regclass('pg_class');
79 SELECT to_regtype('int4');
85 SELECT to_regcollation('"POSIX"');
92 SELECT regoper('pg_catalog.||/');
98 SELECT regoperator('pg_catalog.+(int4,int4)');
104 SELECT regproc('pg_catalog.now');
110 SELECT regprocedure('pg_catalog.abs(numeric)');
116 SELECT regclass('pg_catalog.pg_class');
122 SELECT regtype('pg_catalog.int4');
128 SELECT regcollation('pg_catalog."POSIX"');
134 SELECT to_regoper('pg_catalog.||/');
140 SELECT to_regproc('pg_catalog.now');
146 SELECT to_regprocedure('pg_catalog.abs(numeric)');
152 SELECT to_regclass('pg_catalog.pg_class');
158 SELECT to_regtype('pg_catalog.int4');
164 SELECT to_regcollation('pg_catalog."POSIX"');
170 -- schemaname not applicable
171 SELECT regrole('regress_regrole_test');
173 ----------------------
177 SELECT regrole('"regress_regrole_test"');
179 ----------------------
183 SELECT regnamespace('pg_catalog');
189 SELECT regnamespace('"pg_catalog"');
195 SELECT to_regrole('regress_regrole_test');
197 ----------------------
201 SELECT to_regrole('"regress_regrole_test"');
203 ----------------------
207 SELECT to_regnamespace('pg_catalog');
213 SELECT to_regnamespace('"pg_catalog"');
219 /* If objects don't exist, raise errors. */
220 DROP ROLE regress_regrole_test;
221 -- without schemaname
222 SELECT regoper('||//');
223 ERROR: operator does not exist: ||//
224 LINE 1: SELECT regoper('||//');
226 SELECT regoperator('++(int4,int4)');
227 ERROR: operator does not exist: ++(int4,int4)
228 LINE 1: SELECT regoperator('++(int4,int4)');
230 SELECT regproc('know');
231 ERROR: function "know" does not exist
232 LINE 1: SELECT regproc('know');
234 SELECT regprocedure('absinthe(numeric)');
235 ERROR: function "absinthe(numeric)" does not exist
236 LINE 1: SELECT regprocedure('absinthe(numeric)');
238 SELECT regclass('pg_classes');
239 ERROR: relation "pg_classes" does not exist
240 LINE 1: SELECT regclass('pg_classes');
242 SELECT regtype('int3');
243 ERROR: type "int3" does not exist
244 LINE 1: SELECT regtype('int3');
247 SELECT regoper('ng_catalog.||/');
248 ERROR: schema "ng_catalog" does not exist
249 LINE 1: SELECT regoper('ng_catalog.||/');
251 SELECT regoperator('ng_catalog.+(int4,int4)');
252 ERROR: operator does not exist: ng_catalog.+(int4,int4)
253 LINE 1: SELECT regoperator('ng_catalog.+(int4,int4)');
255 SELECT regproc('ng_catalog.now');
256 ERROR: schema "ng_catalog" does not exist
257 LINE 1: SELECT regproc('ng_catalog.now');
259 SELECT regprocedure('ng_catalog.abs(numeric)');
260 ERROR: schema "ng_catalog" does not exist
261 LINE 1: SELECT regprocedure('ng_catalog.abs(numeric)');
263 SELECT regclass('ng_catalog.pg_class');
264 ERROR: schema "ng_catalog" does not exist
265 LINE 1: SELECT regclass('ng_catalog.pg_class');
267 SELECT regtype('ng_catalog.int4');
268 ERROR: schema "ng_catalog" does not exist
269 LINE 1: SELECT regtype('ng_catalog.int4');
271 SELECT regcollation('ng_catalog."POSIX"');
272 ERROR: schema "ng_catalog" does not exist
273 LINE 1: SELECT regcollation('ng_catalog."POSIX"');
275 -- schemaname not applicable
276 SELECT regrole('regress_regrole_test');
277 ERROR: role "regress_regrole_test" does not exist
278 LINE 1: SELECT regrole('regress_regrole_test');
280 SELECT regrole('"regress_regrole_test"');
281 ERROR: role "regress_regrole_test" does not exist
282 LINE 1: SELECT regrole('"regress_regrole_test"');
284 SELECT regrole('Nonexistent');
285 ERROR: role "nonexistent" does not exist
286 LINE 1: SELECT regrole('Nonexistent');
288 SELECT regrole('"Nonexistent"');
289 ERROR: role "Nonexistent" does not exist
290 LINE 1: SELECT regrole('"Nonexistent"');
292 SELECT regrole('foo.bar');
293 ERROR: invalid name syntax
294 LINE 1: SELECT regrole('foo.bar');
296 SELECT regnamespace('Nonexistent');
297 ERROR: schema "nonexistent" does not exist
298 LINE 1: SELECT regnamespace('Nonexistent');
300 SELECT regnamespace('"Nonexistent"');
301 ERROR: schema "Nonexistent" does not exist
302 LINE 1: SELECT regnamespace('"Nonexistent"');
304 SELECT regnamespace('foo.bar');
305 ERROR: invalid name syntax
306 LINE 1: SELECT regnamespace('foo.bar');
308 /* If objects don't exist, return NULL with no error. */
309 -- without schemaname
310 SELECT to_regoper('||//');
316 SELECT to_regoperator('++(int4,int4)');
322 SELECT to_regproc('know');
328 SELECT to_regprocedure('absinthe(numeric)');
334 SELECT to_regclass('pg_classes');
340 SELECT to_regtype('int3');
346 SELECT to_regcollation('notacollation');
353 SELECT to_regoper('ng_catalog.||/');
359 SELECT to_regoperator('ng_catalog.+(int4,int4)');
365 SELECT to_regproc('ng_catalog.now');
371 SELECT to_regprocedure('ng_catalog.abs(numeric)');
377 SELECT to_regclass('ng_catalog.pg_class');
383 SELECT to_regtype('ng_catalog.int4');
389 SELECT to_regcollation('ng_catalog."POSIX"');
395 -- schemaname not applicable
396 SELECT to_regrole('regress_regrole_test');
402 SELECT to_regrole('"regress_regrole_test"');
408 SELECT to_regrole('foo.bar');
409 ERROR: invalid name syntax
410 SELECT to_regrole('Nonexistent');
416 SELECT to_regrole('"Nonexistent"');
422 SELECT to_regrole('foo.bar');
423 ERROR: invalid name syntax
424 SELECT to_regnamespace('Nonexistent');
430 SELECT to_regnamespace('"Nonexistent"');
436 SELECT to_regnamespace('foo.bar');
437 ERROR: invalid name syntax