Re: Confused by result of pg_catalog.format_type() - Mailing list pgsql-general

From Tom Lane
Subject Re: Confused by result of pg_catalog.format_type()
Date
Msg-id 9548.1209075044@sss.pgh.pa.us
Whole thread Raw
In response to Re: Confused by result of pg_catalog.format_type()  (Erik Jones <erik@myemma.com>)
Responses Re: Confused by result of pg_catalog.format_type()  (Erik Jones <erik@myemma.com>)
List pgsql-general
Erik Jones <erik@myemma.com> writes:
> Ah, pg_catalog.format_type(prorettype, null) = '"trigger"', thanks.

It's probably fair to ask what it is you want to accomplish here,
because comparing format_type's output to a constant seems awfully
fragile.  Aside from the quotes (which I believe 8.3 won't emit in
this particular case) the output can vary depending on search_path
and perhaps other factors.

If you're trying to identify trigger functions I'd suggest

    where prorettype = 'pg_catalog.trigger'::pg_catalog.regtype

as being the most bulletproof formulation, and probably faster too.

            regards, tom lane

pgsql-general by date:

Previous
From: Erik Jones
Date:
Subject: Re: Confused by result of pg_catalog.format_type()
Next
From: "Scott Marlowe"
Date:
Subject: Re: query question really cant give a summary here so read the body ;-)