Re: Oracle Style packages on postgres

From: Thomas Hallgren <thhal(at)mailblocks(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, rmm(at)sqlisor(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Oracle Style packages on postgres
Date: 2005-05-10 14:34:23
Message-ID: thhal-0815cA1GfyicJ8zNpSue0JxA2rqxzGw@mailblocks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian wrote:

>Thomas Hallgren wrote:
>
>
>>Bruce Momjian wrote:
>>
>>
>>>Josh Berkus wrote:
>>>
>>>
>>>
>>>>I think that private variables and private functions need to be part of the
>>>>definition.
>>>>
>>>>
>>>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?
>>>
>>>
>>>
>>The standard says that rather then using nested schemas or packages in
>>conjunction with functions in order to group functions with data, use
>>user defined types with attributes and methods. Methods can be STATIC,
>>INSTANCE or CONSTRUCTOR.
>>
>>
>
>So it sounds like you group the functions into user-defined types,
>rather than nested schemas.
>
Yes, you'd get <schema>.<type>.<method> as the fully qualified name.

> So you assocate functions with a table?
>
>
Not necessarily a table. A type is just a type. A type containing just
static methods is not very different from an Oracle package. A table
created from a type may of course have methods associated with it. That
gets really interesting when you use INSTANCE methods. They act on a per
row basis so that you can do things like:

SELECT x.someMethod() FROM someTable x;

rather than as today.

SELECT someFunction(x) FROM someTable x;

Regards,
Thomas Hallgren

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-05-10 14:34:33 Re: Cost of XLogInsert CRC calculations
Previous Message Tom Lane 2005-05-10 14:30:55 Re: Cost of XLogInsert CRC calculations