Re: [HACKERS] Selecting user-defined CASTs

2011-08-09 Thread Joe Abbate
On 08/09/2011 01:27 AM, Tom Lane wrote: > Another approach is to check pg_depend. A cast installed by initdb will > match a "pin" entry in pg_depend (refclassid = pg_cast, refobjid = > cast's OID, deptype = 'p'). You're still out of luck for distinguishing > extension members in existing releases

Re: [HACKERS] Selecting user-defined CASTs

2011-08-09 Thread Heikki Linnakangas
On 09.08.2011 08:27, Tom Lane wrote: select ... from pg_cast c where c.oid>= 16384; What that really does is eliminate the casts that were installed during initdb, which are at least a subset of the "system" ones, and might be all of them depending on what you feel a "system" cast is. The main

Re: [HACKERS] Selecting user-defined CASTs

2011-08-08 Thread Tom Lane
Joe Abbate writes: > I'm trying to query the catalogs to select only the user-defined CASTs This is rather difficult to do, actually, because pg_cast stores neither an owner nor a schema for casts, which eliminates all of the principled ways in which you might decide that a cast belongs to "the s

Re: [HACKERS] Selecting user-defined CASTs

2011-08-08 Thread Joe Abbate
On 08/08/2011 06:31 PM, Joe Abbate wrote: > It seems the only way out is to do something like a 9-way join between > pg_cast, pg_type, pg_proc and pg_namespace to test the source, target > and function namespaces much as dumpCast() does in pg_dump.c. Before I > go that route, I'd thought I'd check

[HACKERS] Selecting user-defined CASTs

2011-08-08 Thread Joe Abbate
Hi, I'm trying to query the catalogs to select only the user-defined CASTs (my test db only has one such CAST). Looking at pg_dump.c, I've come up with the following so far: SELECT castsource::regtype AS source, casttarget::regtype AS target, castfunc::regprocedure AS f