Extensions

A series of patches implements extensions support for dump and restore for PostgreSQL. In order to reach this goal, several things need to happen, and the patch is quite large by now. This is the diffstat of the cumulative branch:

Overview

The extension patch has to be considered with the dump and restore support in mind. About all that is done is to that end, there is very few extra in there. The goal is for pg_dump not to output the extension's install script, that is maintained separately from the database objects. That allows for easier restores too, when the extension needs to be upgraded. What we want to see in the dump is:

CREATE EXTENSION citext WITH SCHEMA foo NO USER DATA;

For schema support, see the discussion above.

Some extension will install tables where users will be able to edit the data, or use commands and functions that will change the data for them. The line of though here is that the data will change and that we want to have them as part of the dump, because the maintenance of those data is not done in the extension's SCM but in the database.

User Interface

psql

There's both \dx to list installed extensions and \dx+ to list installed and available extensions.

user data and extensions

The extension's patches goal is for pg_dump *NOT* to care about extension's objects, because they are maintained in some repository out there, not in the database. There's an exception here, when the extension installs tables (or anything, really) that the user can edit, directly or through some facilities given by the extension. Now we need to dump those as well.

Extension authors have a function they can call from their scripts to flag some objects are necessary to dump, and the documentation contains this example:

Such flags will make it so that pg_dump will dump the objects separately. The idea is that the dependency between the object and its extension is changed from DEPENDENCY_INTERNAL (no dump) to DEPENDENCY_NORMAL (dump).

schema and extensions

The schema support has been asked for on the -hackers list and is a simple search and replace of the @extschema@

pg_dump support

Authoring Extension

Contrib changes

The control file

Allows to register an extension into the catalogs. Minimal meta-data and syntax support (uses recovery.conf parser), fixed expected location alongside the SQL script, pgxs support