User:Ziga/xpg package

From PostgreSQL wiki
Jump to navigationJump to search


xpg_package - installer for PostgreSQL extensions


% xpg_package load template1 tsearch2
% xpg_package -n my_schema load my_database ltree
% xpg_package update
% xpg_package install newsysviews
% xpg_package load my_database newsysviews


Purpose: make it easy to manage extensions in your databases

A tool in the spirit of Perl CPAN installation tool, but for PostgresSQL and PgFoundry (and others).


The following are needed for sure. Probably more...

  • update - fetch list of packages from internet. PgFoundry and such...
  • look - get and unpack, cd into build, to allow user to build manually
  • install - compile, test and install in system (/usr/share and such)
  • load - load extension into a particular database/schema
  • list - installed/loaded extensions
  • unload - unload extension
  • upgrade - upgrade installed package (perhaps load should do this?)


  • installation data should be kept in a database (Codd rule)
  • it should be possible to keep multiple different versions of packages installed on system

How to handle source/binary (not a problem for SQL-only packages)

Two flavors:

  • packages with schemas (these usually come with various PostgreSQL based applications -

now it is a major problem to upgrade such databases)

  • packages which can be loaded into any schema

Must also manage: users, schemas, languages

Handle package installation transactionally - either install/upgrade cleanly or not at all (optionally disabled)

Installer should handle such stuff as is now done with shell scripts like

packages provide:

  • XML file describing the extension
  • SQL install instructions
  • SQL uninstall instructions
  • SQL upgrade instructions (incremental for each version of extension)
  • source + makefiles for compilable parts in C (makefiles can use pg_config)
  • documentation in XML (compatible with PostgreSQL docbook documentation); this can be auto-merged into install of official PostgresSQL documentation when extension is installed


Use of RDF (Semantic Web) technology could be useful for this

  • name
  • version
  • download url
  • author
  • documentation
  • maintainer
  • dependencies
  • link: page, wiki, forge, bugs, mailing-list

See also