Re: Package support for Postgres - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Package support for Postgres
Date
Msg-id Pine.LNX.4.30.0110132111270.643-100000@peter.localdomain
Whole thread Raw
In response to Package support for Postgres  (Bill Studenmund <wrstuden@netbsd.org>)
Responses Re: Package support for Postgres
Re: Package support for Postgres
List pgsql-hackers
Bill Studenmund writes:

> So what are packages? In Oracle, they are a feature which helps developers
> make stored procedures and functions.

I think you have restricted yourself too much to functions and procedures.
A package could/should also be able to contain views, tables, and such.

> They provide a name space for functions local to the package,

Namespacing is the task of schemas.  I think of packages as a bunch of
objects that can be addressed under a common name (think RPMs).

But it seems like some of this work could be used to implement schema
support.

> session-specific package variables,

I think this is assuming a little too much about how a PL might operate.
Some PLs already support this in their own language-specific way, with or
without packages.  Thus, I don't think packages should touch this.
Actually, I think you could easily set up session variables in the package
initializer function.

> The last component of a package are the functions usable for type
> declarations. They are declared as:
> BEFORE TYPE FUNCTION <standard package function declaration>
>
> They are useful as the normal functions in a package are declared after
> the types are declared, so that they can use a type newly-defined in a
> package.

I think it would make much more sense to allow the creation of objects in
the CREATE PACKAGE command in any order.  PostgreSQL has not so far had a
concept of "functions suitable for type declarations" and we shouldn't add
one.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: EXTRACT broken
Next
From: Bruce Momjian
Date:
Subject: Re: FAQ error