Re: Schema name of function

From: "John Hansen" <john(at)geeknet(dot)com(dot)au>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Michael Fuhr" <mike(at)fuhr(dot)org>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Schema name of function
Date: 2005-02-14 21:36:44
Message-ID: 5066E5A966339E42AA04BA10BA706AE5624D@rodrick.geeknet.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Beautiful, just what I was looking for.

Thnx,

John

> -----Original Message-----
> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> Sent: Tuesday, February 15, 2005 6:31 AM
> To: Michael Fuhr
> Cc: John Hansen; pgsql-hackers(at)postgresql(dot)org
> Subject: Re: [HACKERS] Schema name of function
>
> Michael Fuhr <mike(at)fuhr(dot)org> writes:
> > On Mon, Feb 14, 2005 at 11:11:53AM -0500, Tom Lane wrote:
> >> In C, it'd be a lot easier (and faster) to do a couple of
> >> SearchSysCache calls than to use SPI to get those rows.
>
> > The following appears to work -- does it look right, aside from the
> > missing error checking?
>
> > tuple = SearchSysCache(PROCOID,
> > ObjectIdGetDatum(fcinfo->flinfo->fn_oid),
> > 0, 0, 0);
> > nsoid = SysCacheGetAttr(PROCOID, tuple,
> > Anum_pg_proc_pronamespace, &isnull);
> > schemaname = get_namespace_name(nsoid);
> > ReleaseSysCache(tuple);
>
> That would work. Since pronamespace is one of the fixed
> non-nullable columns of pg_proc, you don't really need to use
> SysCacheGetAttr: you can just map the C struct onto the tuple
> and grab the field directly.
>
> nsoid = ((Form_pg_proc) GETSTRUCT(tuple))->pronamespace;
>
> utils/cache/lsyscache.c contains lots of examples of this
> sort of thing.
> (get_namespace_name is one, in fact.)
>
> regards, tom lane
>
>

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-02-14 23:17:48 8.0.X and the ARC patent
Previous Message pgsql 2005-02-14 20:54:48 Re: enforcing a plan (in brief)