PGFoundry Elephant Icon

Welcome to the pg_packages Free package implementation Project Home Page

Free and complete alternative to Oracle-like package implementation for PostgreSQL, including persistent variables, procedure and function logical wrapping, package declaration, optional initialization, overloading and easy pl/pgsql administration.

The pg_packages Free package implementationproject is a PostgreSQL Community project that is a part of the pgFoundry.

The pgFoundry page for the project is at, where you can find downloads, documentation, bug reports, mailing lists, and a whole lot more.


What is a package?
A package is a group of procedures, functions, variables definitions, SQL statements and initialization routines created as a single unit in a special schema.
How does a package look like?
A package has two parts, a Package Definition or Header, which contains global variable definitions, procedures and functions specifications, and a Package Body, which contains the actual implementation of the programs.
Advantages of packages
  1. Modularity. Stores related objects together, which eases development.
  2. API separation. You can define and compile the Package Definition alone, and later compile the Body.
  3. Defined visibility. Types, variables and subprograms can be defined either private or public.
  4. Naming consistency. You don't have to worry about programs names because they are related just to the package which created them.
  5. Functionality. You can have session global variables that are persistent through sucesive calls.

Project scope

Initially pg_packages implementation will be made entirely in Pl/pgSQL. When the solution proves to be robust enough, a patch to the Postgresql source will be submitted to include the corresponding syntax and grammar.

Tentative Roadmap

  1. Creation of underlying database objects to support pg_packages implementation
  2. Create first self-contained prototype
  3. Testing
  4. Syntax creation proposal. Postgresql source code patching.
  5. Extension to other languages (Perl, Python, Java)


Although pg_packages is conceived as an alternative to Oracle packages, there is no intention to break the general Postgresql syntax. However, a considerable effort will be put to make the transition as seamless as possible, specially on package creation.

Powered By GForge Collaborative Development Environment