Re: Oracle Style packages on postgres

From: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>
To: Thomas Hallgren <thhal(at)mailblocks(dot)com>
Cc: josh(at)agliodbs(dot)com, rmm(at)sqlisor(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Oracle Style packages on postgres
Date: 2005-05-10 18:51:18
Message-ID: 20050510185118.GL31103@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 10, 2005 at 08:40:16PM +0200, Thomas Hallgren wrote:
> Jim C. Nasby wrote:
>
> >I don't believe types allow for internal-only methods. I seem to recall
> >other limitations on what types could do as opposed to packages. Of
> >course, we need not restrict ourselves in such a manner.
> >
> >
> Do Oracle packages support internal only functions? If they do, then I
> agree, that's a feature that the SQL standard doesn't have.

AFAIK anything in an Oracle packages can be internal-only. You just
exclude it from the header.

> I see this differently. A full implementation of the SQL-standard for
> UDT's will allow abstract types, inheritance, method overloading, etc.
> It quickly becomes far more flexible then Oracle packages. A full
> implementation is of course beyond the scope for what's needed to
> accommodate the needs of those who use packages but a simple
> implementation is extendable within the scope of the standard.

Packages allow for abstract types and method overloading. They don't
allow for inheritance.

> >The good news is that they should both be able to use the same
> >underlying framework. Types are afterall just a specialized
> >implementation of packages.
> >
> >
> Right. Given a good implementation of types, packages would be easy to
> implement. The other way around would not be possible. A package is a
> very restricted type that contains static methods only. Possibly with
> the extension of some kind of method/attribute visibility.

I guess maybe I'm not clear on what you mean by static methods. IIRC, in
Oracle nomenclature, static means it will retain state between
invocations in the same session. Of course, functions and procedures
that don't do this are also allowed.

Basically, before we assume that one implementation allows for the other
I think some research needs to be done. Hopefully someone on the list is
familiar with both. I think it would be a huge win if we could offer a
compatability mechanism that makes it easy for Oracle packages to be
used in PostgreSQL, making migration from Oracle much, much easier.

> So do we need "internal only" functions although they are not covered by
> the SQL-standard? If the answer is no, then IMO we should follow the
> standard and use types, not packages. If the answer is yes, then the
> SQL-standard is not enough. Should we then use packages or simply
> introduce the keyword PRIVATE on methods of a type? Personally, I'd go
> for the latter and then, if necessary, build packages on top of that in
> for the benefit of Oracle users who wants to migrate. A fully fledged
> type system will ease Oracle migration too since Oracle already has this.

I think both should allow for private functions/procedures/methods. BTW,
I'm also very keen on the idea of nested schemas, which is another
possible means to the package ends.
--
Jim C. Nasby, Database Consultant decibel(at)decibel(dot)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?"

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-05-10 19:01:35 Re: Table Partitioning, Part 1
Previous Message Thomas Hallgren 2005-05-10 18:40:16 Re: Oracle Style packages on postgres