Skip site navigation (1) Skip section navigation (2)

Re: Confused by result of pg_catalog.format_type()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Erik Jones <erik(at)myemma(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Confused by result of pg_catalog.format_type()
Date: 2008-04-24 22:10:44
Message-ID: 9548.1209075044@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-general
Erik Jones <erik(at)myemma(dot)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

In response to

Responses

pgsql-general by date

Next:From: Scott MarloweDate: 2008-04-24 22:43:11
Subject: Re: query question really cant give a summary here so read the body ;-)
Previous:From: Erik JonesDate: 2008-04-24 22:04:07
Subject: Re: Confused by result of pg_catalog.format_type()

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group