When you do this query:

SET SEARCH_PATH TO pg_catalog;

SELECT castsource::pg_catalog.regtype AS castsource, 
casttarget::pg_catalog.regtype AS casttarget, 
castfunc::pg_catalog.regprocedure AS castfunc, 
castfunc::pg_catalog.regproc AS castfunc2 FROM pg_catalog.pg_cast ORDER 
BY 1, 2;

Only regproc adds the unnecessary pg_catalog. qualification, why is that?

Results:

-[ RECORD 1 ]----------------------------------------
castsource | "char"
casttarget | text
castfunc   | text("char")
castfunc2  | pg_catalog.text
-[ RECORD 2 ]----------------------------------------
castsource | "char"
casttarget | character
castfunc   | bpchar("char")
castfunc2  | pg_catalog.bpchar
-[ RECORD 3 ]----------------------------------------
castsource | name
casttarget | text
castfunc   | text(name)
castfunc2  | pg_catalog.text
-[ RECORD 4 ]----------------------------------------
castsource | name
casttarget | character
castfunc   | bpchar(name)
castfunc2  | pg_catalog.bpchar
-[ RECORD 5 ]----------------------------------------
castsource | name
casttarget | character varying
castfunc   | "varchar"(name)
castfunc2  | pg_catalog."varchar"
-[ RECORD 6 ]----------------------------------------
castsource | bigint
casttarget | smallint
castfunc   | int2(bigint)
castfunc2  | pg_catalog.int2
-[ RECORD 7 ]----------------------------------------
castsource | bigint
casttarget | integer
castfunc   | int4(bigint)
castfunc2  | pg_catalog.int4
...



Tue, 28 Oct 2003 11:48:21 +0800
Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Slightly inconsistent behaviour in regproc?
Christopher Kings-Lynne <chriskl@familyhealth.com.au> writes:
> Only regproc adds the unnecessary pg_catalog. qualification, why is that?

Er, I couldn't see the part of your example where that happened?

			regards, tom lane

Tue, 28 Oct 2003 00:35:09 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: Slightly inconsistent behaviour in regproc? 
>>Only regproc adds the unnecessary pg_catalog. qualification, why is that?
> 
> 
> Er, I couldn't see the part of your example where that happened?

Basically, my question is why ::regproc alone always addes the catalogue 
qualification in this case?

Rows below correspond to:

::regtype
::regtype
::regprocedure
::regproc

-[ RECORD 1 ]----------------------------------------
castsource | "char"
casttarget | text
castfunc   | text("char")
castfunc2  | pg_catalog.text

eg. Why is it not:

-[ RECORD 1 ]----------------------------------------
castsource | "char"
casttarget | text
castfunc   | text("char")
castfunc2  | text

Or even:

-[ RECORD 1 ]----------------------------------------
castsource | pg_catalog."char"
casttarget | pg_catalog.text
castfunc   | pg_catalog.text("char")
castfunc2  | pg_catalog.text

Chris



Tue, 28 Oct 2003 14:25:44 +0800
Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Re: Slightly inconsistent behaviour in regproc?
Christopher Kings-Lynne <chriskl@familyhealth.com.au> writes:
> Basically, my question is why ::regproc alone always addes the catalogue 
> qualification in this case?

regproc adds the schema if the name would be ambiguous without it (or
not visible at all).  In these cases, the function name is still
ambiguous with the schema :-( ... but there's nothing regproc can do
about that, since it's not chartered to emit function arguments.
Use regprocedure instead if you don't want to see schema names.

			regards, tom lane

Tue, 28 Oct 2003 09:40:15 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: Slightly inconsistent behaviour in regproc? 