Bruce Momjian wrote:
Josh Berkus wrote:
Or we could just add local variables to schema and dispense with
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.
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
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.
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.
I'd guess we'd need a pg_package and pg_package_items system tables. We
- package name (different from schema)
- version number
- install/uninstall functions
- start-session/end-session functions
- dependencies (is pg_depend enough)
- variables, functions, tables, views etc
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?