Re: Oracle Style packages on postgres

From: Thomas Hallgren <thhal(at)mailblocks(dot)com>
To: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>
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:40:16
Message-ID: thhal-0k5hcAw2jyicJpvf2haQkgvJkc3csTt@mailblocks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

>Types are not used nearly as much as packages (this is an issue if we
>care about enabling Oracle users to migrate).
>
>Types generally force you to use them in relation to some database
>object. Packages have no such restriction.
>
>
If used as a package, i.e. only containing static methods, you don't
need to use the type in relation to anything. It's simply a namespace.
If used with a temporary table, you get a very neat, standardized,
cross-language way of managing session data.

>Don't get me wrong, I think supporting more powerful types would be a
>welcome addition, but I don't think they can be as flexable as packages.
>
>
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.

>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.

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.

Regards,
Thomas Hallgren

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2005-05-10 18:51:18 Re: Oracle Style packages on postgres
Previous Message Jim C. Nasby 2005-05-10 18:32:15 Re: Table Partitioning, Part 1