Re: Patch: regschema OID type

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: "David E. Wheeler" <david@kineticode.com>
Cc: David Christensen <david@endpoint.com>, pgsql-hackers@postgresql.org
Date: 2010-01-21T18:06:20Z
Lists: pgsql-hackers
"David E. Wheeler" <david@kineticode.com> writes:
> The names of schemas in which to find functions, tables, views, triggers, etc. etc. I have lots of stuff like this:

>         SELECT true
>           FROM pg_catalog.pg_namespace n
>           JOIN pg_catalog.pg_class c ON n.oid = c.relnamespace
>          WHERE c.relkind = $1
>            AND n.nspname = $2
>            AND c.relname = $3

Well, without a context that explains *why* you're doing that, it's hard
to consider what a better solution would look like.  Personally I
usually prefer solutions involving WHERE oid = 'foo.bar'::regclass,
because that scales easily to either providing or omitting the schema
reference.

If you're trying to avoid throwing an error on bad schema name,
a regschema type would not help you.

			regards, tom lane