I've been running a few functions within schema's.  It's annoying that
everything needs to be qualified as it doesn't allow the functions to be
moved very easily.


Would it be appropriate for the function to have it's own schema as
pre-pended onto the user path while in the users function?




14 Jul 2002 20:36:43 -0400
Rod Taylor <rbt@zort.ca>
plpgsql and Schemas
On Sun, 2002-07-14 at 20:36, Rod Taylor wrote:
> I've been running a few functions within schema's.  It's annoying that
> everything needs to be qualified as it doesn't allow the functions to be
> moved very easily.
> 
> 
> Would it be appropriate for the function to have it's own schema as
> pre-pended onto the user path while in the users function?

Thats a weird way of saying 'prepended to the path during function
execution'.


14 Jul 2002 20:39:27 -0400
Rod Taylor <rbt@zort.ca>
Re: plpgsql and Schemas
Rod Taylor <rbt@zort.ca> writes:
> I've been running a few functions within schema's.  It's annoying that
> everything needs to be qualified as it doesn't allow the functions to be
> moved very easily.
> Would it be appropriate for the function to have it's own schema as
> pre-pended onto the user path while in the users function?

Hmm.  I can think of examples where you wouldn't want that (because
the function *should* see the caller's namespace) about as easily
as cases where you would.

If a function wants to access "its own schema", why shouldn't it
use qualified references?

			regards, tom lane

Sun, 14 Jul 2002 21:19:34 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: plpgsql and Schemas 
On Sun, 2002-07-14 at 21:19, Tom Lane wrote:
> Rod Taylor <rbt@zort.ca> writes:
> > I've been running a few functions within schema's.  It's annoying that
> > everything needs to be qualified as it doesn't allow the functions to be
> > moved very easily.
> > Would it be appropriate for the function to have it's own schema as
> > pre-pended onto the user path while in the users function?
> 
> Hmm.  I can think of examples where you wouldn't want that (because
> the function *should* see the caller's namespace) about as easily
> as cases where you would.
> 
> If a function wants to access "its own schema", why shouldn't it
> use qualified references?

I was thinking of the effort put into pg_dump to prevent over qualifying
references in order to allow the user to move stuff easily.  It's not a
big deal, but does prevent this ability with functions.


14 Jul 2002 21:27:11 -0400
Rod Taylor <rbt@zort.ca>
Re: plpgsql and Schemas
Rod Taylor writes:

> I've been running a few functions within schema's.  It's annoying that
> everything needs to be qualified as it doesn't allow the functions to be
> moved very easily.

> Would it be appropriate for the function to have it's own schema as
> pre-pended onto the user path while in the users function?

The SQL standard has rules on how the effective schema path during a
function execution is determined.  In a nutshell, it allows you to specify
the path as an attribute of the containing schema.  E.g.,

    CREATE SCHEMA foo PATH here, there;

I haven't thought this through, but you might want to think about it.

-- 
Peter Eisentraut   peter_e@gmx.net


Tue, 16 Jul 2002 00:55:02 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: plpgsql and Schemas