Re: proposal for PL packages for 8.3. - Mailing list pgsql-hackers

From Richard Huxton
Subject Re: proposal for PL packages for 8.3.
Date
Msg-id 44D990EE.5060108@archonet.com
Whole thread Raw
In response to Re: proposal for PL packages for 8.3.  (Bruce Momjian <bruce@momjian.us>)
Responses Re: proposal for PL packages for 8.3.
Re: proposal for PL packages for 8.3.
Re: proposal for PL packages for 8.3.
List 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


pgsql-hackers by date:

Previous
From: Markus Schiltknecht
Date:
Subject: Re: standard interfaces for replication providers
Next
From: Martijn van Oosterhout
Date:
Subject: Re: proposal for PL packages for 8.3.