Re: proposal for PL packages for 8.3.

From: Richard Huxton <dev(at)archonet(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pavel Stehule <pavel(dot)stehule(at)hotmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: proposal for PL packages for 8.3.
Date: 2006-08-09 07:38:22
Message-ID: 44D990EE.5060108@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian wrote:
> Josh Berkus wrote:
>> Bruce,
>>
>>> I like the idea of a package being a schema. I imagine that a package
>>> would put its own schema name first in the 'search_path' before
>>> referencing an object. I think anything more complex is going to be too
>>> hard to use.
>>>
>> Or we could just add local variables to schema and dispense with
>> PACKAGES entirely.
>
> Sure, makes more sense to me. I don't think people want Oracle syntax
> as much as Oracle packages capabilities.

There are three separate issues we seem to be talking about.

1. Namespaces - visibility or otherwise of objects
2. Procedural state - something that looks like a shared variable
3. Packaging - installation/dependency handling

Namespaces
Given that we already have search_path it makes sense to use it. So, we
could have something like:
1. A "PRIVATE" modifier for objects that mean they are only accessible
if their schema is the first in the search_path.
2. A definable search_path for a schema, so all objects have that
setting by default. In theory, this could break dynamic queries in
functions that relied on a changeable search_path.

Procedural state
Just a convenient way of defining some small amount of state. Will need
session variables and static shared variables. Presumably we'll need to
be able to lock shared variables.

Packaging
I'd guess we'd need a pg_package and pg_package_items system tables. We
could track:
- package name (different from schema)
- version number
- install/uninstall functions
- start-session/end-session functions
- dependencies (is pg_depend enough)
pg_package_items
- schema-name
- variables, functions, tables, views etc

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-08-09 08:02:50 Re: proposal for PL packages for 8.3.
Previous Message Markus Schiltknecht 2006-08-09 07:33:35 Re: standard interfaces for replication providers