Re: Oracle Style packages on postgres - Mailing list pgsql-hackers

From Jim C. Nasby
Subject Re: Oracle Style packages on postgres
Date
Msg-id 20050510180701.GJ31103@decibel.org
Whole thread Raw
In response to Re: Oracle Style packages on postgres  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
On Mon, May 09, 2005 at 09:56:53PM -0400, Bruce Momjian wrote:
> OK, so it seems we need:
> 
>     C static/private functions for schemas
>     C static/private variables for schemas
> 
> Are private variables implemented via the temporary per-session schema?
> 
>     nested schemas
> 
> What does the standard say?
> 
> Is that it?

I think a big part of the usefulness of packages is in supplying an
additional level of grouping common things together. Of course, nested
schemas with public/private functions (and procedures, lest we forget
them) is a much better way to do this, since a schema can encompass
everything you'd need; tables, views, types, etc.

Having said that, I would say that private variables need to be exposed
via the same nested schema interface as everything else. If the
implementation under the covers is via the temporary schema, that's
fine.

As for using temporary tables as session storage, that has a huge
performance penalty associated with it. Part of the advantage to package
variables is that you can use them to cache information your code will
need to access frequently. That access then becomes a simple variable or
array read, which is obviously much faster than parsing a query to hit a
temp table.

There is one feature not mentioned by Bruce's design, and that's
initialization (and teardown) code. I don't recall using that capability
in Oracle, but I was wondering if others with more experience could
comment on it.
-- 
Jim C. Nasby, Database Consultant               decibel@decibel.org 
Give your computer some brain candy! www.distributed.net Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"


pgsql-hackers by date:

Previous
From: Andrew - Supernews
Date:
Subject: Re: Views, views, views! (long)
Next
From: Heikki Linnakangas
Date:
Subject: Re: Please clarify