PostgreSQL extension s development

Similar documents
PGCon PostgreSQL Performance Pitfalls

Module 7. Backup and Recovery

PostgreSQL Backup Strategies

AVALANCHE MC 5.3 AND DATABASE MANAGEMENT SYSTEMS

Administering your PostgreSQL Geodatabase

CRM Global Search: Installation & Configuration

Database Backup and Restore Mechanism. Presented by : Mary Meladath

PostgreSQL as an integrated data analysis platform

Written by Wirabumi Software Sunday, 30 December :27 - Last Updated Thursday, 03 January :52

PostgreSQL (System) Administration

Backup and Recovery using PITR Mark Jones EnterpriseDB Corporation. All rights reserved. 1

Getting ready for PostgreSQL 9.1

Lab 2: PostgreSQL Tutorial II: Command Line

DBI-Link: 3.0. PgCon Ottawa 2008 Copyright David Fetter 2008 All Rights Reserved

RUGGEDCOM NMS for Linux v1.6

Module 07. Log Shipping

A basic create statement for a simple student table would look like the following.

Moving the Web Security Log Database

SQL Server Replication Guide

Protecting SQL Server Databases Software Pursuits, Inc.

PostgreSQL Audit Extension User Guide Version 1.0beta. Open Source PostgreSQL Audit Logging

Moving the TRITON Reporting Databases

How to Set Up pgagent for Postgres Plus. A Postgres Evaluation Quick Tutorial From EnterpriseDB

How to Improve Database Connectivity With the Data Tools Platform. John Graham (Sybase Data Tooling) Brian Payton (IBM Information Management)

Migrating helpdesk to a new server

]project-open[ V3.0. Operations & Maintenance Guide

Integrating VoltDB with Hadoop

AWS Schema Conversion Tool. User Guide Version 1.0

How to Dump and Restore Postgres Plus (R) Databases Using pgadmin. A Postgres Evaluation Quick Tutorial From EnterpriseDB

How to Backup Your Eclipse.Net Database Automatically. To clearly document a specific automatic SQL database backup method for Eclipse.net.

EVENT LOG MANAGEMENT...

Backup and Restore Instructions. Backing up the Content Manager s Data

Microsoft. Course 20463C: Implementing a Data Warehouse with Microsoft SQL Server

Click Studios. Passwordstate. Upgrade Instructions to V7 from V5.xx

Division of IT Security Best Practices for Database Management Systems

OpenGeo Suite for Linux Release 3.0

Trusted RUBIX TM. Version 6. Installation and Quick Start Guide Red Hat Enterprise Linux 6 SELinux Platform. Revision 6

HareDB HBase Client Web Version USER MANUAL HAREDB TEAM

Scala InfoChannel Content Manager 5 Backup and Restore Instructions

Eine Tour durch PostgreSQL-Contrib

Oracle Database 10g: Introduction to SQL

Oracle Database 12c: Introduction to SQL Ed 1.1

WebSphere Business Monitor

ESET REMOTE ADMINISTRATOR. Migration guide

Backing up and restoring HP Systems Insight Manager 6.0 or greater data files in a Windows environment

Upgrading MySQL from 32-bit to 64-bit

Introduction. There are several bits of information that must be moved:

This article Includes:

Restoring Microsoft SQL Server 7 Master Databases

Course 6234A: Implementing and Maintaining Microsoft SQL Server 2008 Analysis Services

Acronis Backup & Recovery 10 Server for Linux. Update 5. Installation Guide

This is a training module for Maximo Asset Management V7.1. It demonstrates how to use the E-Audit function.

FileMaker Server 7 and FileMaker Server 7 Advanced Documentation Errata

Configuring an Alternative Database for SAS Web Infrastructure Platform Services

You will be prompted for a password for the postgres user. In the example below,

Backup Cisco ICM Database in Microsoft SQL 2000

How to Configure and Use SQL with EnCase Products

Secure Messaging Server Console... 2

Upgrading Good Mobile Messaging and Good Mobile Control Servers

Notes Transfer instructions INTRODUCTION More information

SharePoint Backup Guide

PRECISION v16.0 MSSQL Database. Installation Guide. Page 1 of 45

Predicting Change Outcomes Leveraging SQL Server Profiler

SQL Databases Course. by Applied Technology Research Center. This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases.

Database Fundamentals

SQL Server Instance-Level Benchmarks with DVDStore

Video Administration Backup and Restore Procedures

Setting up PostgreSQL

Click to begin. Maitre'D Full System Backup & Restore

Programming Database lectures for mathema

FileMaker 12. ODBC and JDBC Guide

Published. Technical Bulletin: Use and Configuration of Quanterix Database Backup Scripts 1. PURPOSE 2. REFERENCES 3.

Using Symantec NetBackup with Symantec Security Information Manager 4.5

SQL Server Instance-Level Benchmarks with HammerDB

VeriCentre 3.0 Upgrade Pre-Installation and Post Installation Guidelines

NetBrain Enterprise Edition 6.0a NetBrain Server Backup and Failover Setup

Spector 360 Deployment Guide. Version 7.3 January 3, 2012

Getting ready for PostgreSQL 9.1

SQL Server Training Course Content

Upgrade Guide BES12. Version 12.1

Distributed Version Control with Mercurial and git

Jet Data Manager 2012 User Guide

ibolt V3.2 Release Notes

Backup and Restore with 3 rd Party Applications

php tek 2006 in Orlando Florida Lukas Kahwe Smith

citools Documentation

Backup and Recovery Procedures

Technical Script AIST3410 Database Management systems p 1

J j enterpririse. Oracle Application Express 3. Develop Native Oracle database-centric web applications quickly and easily with Oracle APEX

Dream Report Version 4.5

FileMaker 11. ODBC and JDBC Guide

Transcription:

May 20, 2011

Content Agenda 1 Before 9.1 and CREATE EXTENSION 2 Scope Specs Implementation details... 3 PGXS and the control file Extensions Upgrades Extensions and packaging 4 Sponsoring Any question?

Content Agenda 1 Before 9.1 and CREATE EXTENSION 2 Scope Specs Implementation details... 3 PGXS and the control file Extensions Upgrades Extensions and packaging 4 Sponsoring Any question?

Content Agenda 1 Before 9.1 and CREATE EXTENSION 2 Scope Specs Implementation details... 3 PGXS and the control file Extensions Upgrades Extensions and packaging 4 Sponsoring Any question?

Content Agenda 1 Before 9.1 and CREATE EXTENSION 2 Scope Specs Implementation details... 3 PGXS and the control file Extensions Upgrades Extensions and packaging 4 Sponsoring Any question?

Before 9.1 and CREATE EXTENSION What is a Extension?

Definitions Agenda Before 9.1 and CREATE EXTENSION PostgreSQL extensibility is remarkable but incomplete. Example (Basic SQL query) SELECT col FROM table WHERE stamped > date today - interval 1 day

Some extensions example Before 9.1 and CREATE EXTENSION 46 Contribs, Community extensions, Private ones... cube adminpack PostGIS pgcrypto ltree pgq ip4r pg_stattuple citext pg_trgm temporal pg_freespacemap hstore wildspeed prefix pg_stat_statements intagg dblink pgfincore pg_standby

Before 9.1 and CREATE EXTENSION PostgreSQL extensibility is remarkable but incomplete. It lacks dump and restore support.

Before 9.1 and CREATE EXTENSION Before 9.1 and CREATE EXTENSION

Installing an extension Before 9.1 and CREATE EXTENSION Example (Installing an extension before 9.1) apt-get install postgresql-contrib-9.0 apt-get install postgresql-9.0-ip4r psql -f /usr/share/postgresql/9.0/contrib/hstore.sql so, what did it install? ok, reading the script Oh, nice, it s all in the public schema Oh, very nice, no ALTER OPERATOR SET SCHEMA Wait, it gets better!

Installing an extension Before 9.1 and CREATE EXTENSION Example (Installing an extension before 9.1) apt-get install postgresql-contrib-9.0 apt-get install postgresql-9.0-ip4r psql -f /usr/share/postgresql/9.0/contrib/hstore.sql so, what did it install? ok, reading the script Oh, nice, it s all in the public schema Oh, very nice, no ALTER OPERATOR SET SCHEMA Wait, it gets better!

Installing an extension Before 9.1 and CREATE EXTENSION Example (Installing an extension before 9.1) apt-get install postgresql-contrib-9.0 apt-get install postgresql-9.0-ip4r psql -f /usr/share/postgresql/9.0/contrib/hstore.sql so, what did it install? ok, reading the script Oh, nice, it s all in the public schema Oh, very nice, no ALTER OPERATOR SET SCHEMA Wait, it gets better!

Installing an extension Before 9.1 and CREATE EXTENSION Example (Installing an extension before 9.1) apt-get install postgresql-contrib-9.0 apt-get install postgresql-9.0-ip4r psql -f /usr/share/postgresql/9.0/contrib/hstore.sql so, what did it install? ok, reading the script Oh, nice, it s all in the public schema Oh, very nice, no ALTER OPERATOR SET SCHEMA Wait, it gets better!

Installing an extension Before 9.1 and CREATE EXTENSION Example (Installing an extension before 9.1) apt-get install postgresql-contrib-9.0 apt-get install postgresql-9.0-ip4r psql -f /usr/share/postgresql/9.0/contrib/hstore.sql so, what did it install? ok, reading the script Oh, nice, it s all in the public schema Oh, very nice, no ALTER OPERATOR SET SCHEMA Wait, it gets better!

backup and restores Before 9.1 and CREATE EXTENSION pg_dump -h remote mydb psql fresh extensions objects are an entire part of your database but they are maintained elsewhere, that s just a dependency pg_dump makes no difference what about upgrading systems (system, database, extension)

backup and restores Before 9.1 and CREATE EXTENSION pg_dump -h remote mydb psql fresh extensions objects are an entire part of your database but they are maintained elsewhere, that s just a dependency pg_dump makes no difference what about upgrading systems (system, database, extension)

backup and restores Before 9.1 and CREATE EXTENSION pg_dump -h remote mydb psql fresh extensions objects are an entire part of your database but they are maintained elsewhere, that s just a dependency pg_dump makes no difference what about upgrading systems (system, database, extension)

Scope Specs Implementation details...

What problems are we solving? Scope Specs Implementation details... It s all about clearing up the mess. No feature is accepted in PostgreSQL without complete support for dump and restore nowadays. And that s good news. Example (the goal: have pg_dump output this) CREATE EXTENSION IF NOT EXISTS hstore WITH SCHEMA public;

What problems are we solving? Scope Specs Implementation details... It s all about clearing up the mess. No feature is accepted in PostgreSQL without complete support for dump and restore nowadays. And that s good news. Example (the goal: have pg_dump output this) CREATE EXTENSION IF NOT EXISTS hstore WITH SCHEMA public;

Scope Specs Implementation details... Specs

How are we solving our problems? Scope Specs Implementation details... Lots of little things need to happen: Rely on the OS to install the script and module Register the extension in the catalogs, to get an OID Track dependencies at CREATE EXTENSION time Adapt pg_dump Offer a WITH SCHEMA facility Offer ALTER EXTENSION SET SCHEMA Don t forget DROP EXTENSION RESTRICT CASCADE Manage upgrading ALTER EXTENSION UPDATE

How are we solving our problems? Scope Specs Implementation details... Lots of little things need to happen: Rely on the OS to install the script and module Register the extension in the catalogs, to get an OID Track dependencies at CREATE EXTENSION time Adapt pg_dump Offer a WITH SCHEMA facility Offer ALTER EXTENSION SET SCHEMA Don t forget DROP EXTENSION RESTRICT CASCADE Manage upgrading ALTER EXTENSION UPDATE

How are we solving our problems? Scope Specs Implementation details... Lots of little things need to happen: Rely on the OS to install the script and module Register the extension in the catalogs, to get an OID Track dependencies at CREATE EXTENSION time Adapt pg_dump Offer a WITH SCHEMA facility Offer ALTER EXTENSION SET SCHEMA Don t forget DROP EXTENSION RESTRICT CASCADE Manage upgrading ALTER EXTENSION UPDATE

How are we solving our problems? Scope Specs Implementation details... Lots of little things need to happen: Rely on the OS to install the script and module Register the extension in the catalogs, to get an OID Track dependencies at CREATE EXTENSION time Adapt pg_dump Offer a WITH SCHEMA facility Offer ALTER EXTENSION SET SCHEMA Don t forget DROP EXTENSION RESTRICT CASCADE Manage upgrading ALTER EXTENSION UPDATE

How are we solving our problems? Scope Specs Implementation details... Lots of little things need to happen: Rely on the OS to install the script and module Register the extension in the catalogs, to get an OID Track dependencies at CREATE EXTENSION time Adapt pg_dump Offer a WITH SCHEMA facility Offer ALTER EXTENSION SET SCHEMA Don t forget DROP EXTENSION RESTRICT CASCADE Manage upgrading ALTER EXTENSION UPDATE

How are we solving our problems? Scope Specs Implementation details... Lots of little things need to happen: Rely on the OS to install the script and module Register the extension in the catalogs, to get an OID Track dependencies at CREATE EXTENSION time Adapt pg_dump Offer a WITH SCHEMA facility Offer ALTER EXTENSION SET SCHEMA Don t forget DROP EXTENSION RESTRICT CASCADE Manage upgrading ALTER EXTENSION UPDATE

How are we solving our problems? Scope Specs Implementation details... Lots of little things need to happen: Rely on the OS to install the script and module Register the extension in the catalogs, to get an OID Track dependencies at CREATE EXTENSION time Adapt pg_dump Offer a WITH SCHEMA facility Offer ALTER EXTENSION SET SCHEMA Don t forget DROP EXTENSION RESTRICT CASCADE Manage upgrading ALTER EXTENSION UPDATE

How are we solving our problems? Scope Specs Implementation details... Lots of little things need to happen: Rely on the OS to install the script and module Register the extension in the catalogs, to get an OID Track dependencies at CREATE EXTENSION time Adapt pg_dump Offer a WITH SCHEMA facility Offer ALTER EXTENSION SET SCHEMA Don t forget DROP EXTENSION RESTRICT CASCADE Manage upgrading ALTER EXTENSION UPDATE

Extensions and user data Scope Specs Implementation details... What if an extension gets modified after install? pg_dump support is all about excluding things from dumps some extensions install default data and allow users to edit them now you want the data in your dumps, right?

Extensions and user data Scope Specs Implementation details... What if an extension gets modified after install? pg_dump support is all about excluding things from dumps some extensions install default data and allow users to edit them now you want the data in your dumps, right?

Extensions and user data Scope Specs Implementation details... What if an extension gets modified after install? pg_dump support is all about excluding things from dumps some extensions install default data and allow users to edit them now you want the data in your dumps, right?

Scope Specs Implementation details... Implementation

The effort in figures Scope Specs Implementation details... git diff stat master..extension tail -1 260 files changed, 4202 insertions(+), 2073 deletions(-) git no-pager diff stat extension..upgrade tail -1 125 files changed, 1976 insertions(+), 81 deletions(-) 5 patches, 7 branches, its own Commit Fest section about 18 months to get an agreement on what to develop first 2 Developer Meeting interventions, in Ottawa, PgCon 4 weeks full time, countless evenings, 3 months of refining

The effort in figures Scope Specs Implementation details... git diff stat master..extension tail -1 260 files changed, 4202 insertions(+), 2073 deletions(-) git no-pager diff stat extension..upgrade tail -1 125 files changed, 1976 insertions(+), 81 deletions(-) 5 patches, 7 branches, its own Commit Fest section about 18 months to get an agreement on what to develop first 2 Developer Meeting interventions, in Ottawa, PgCon 4 weeks full time, countless evenings, 3 months of refining

The effort in figures Scope Specs Implementation details... git diff stat master..extension tail -1 260 files changed, 4202 insertions(+), 2073 deletions(-) git no-pager diff stat extension..upgrade tail -1 125 files changed, 1976 insertions(+), 81 deletions(-) 5 patches, 7 branches, its own Commit Fest section about 18 months to get an agreement on what to develop first 2 Developer Meeting interventions, in Ottawa, PgCon 4 weeks full time, countless evenings, 3 months of refining

The effort in figures Scope Specs Implementation details... git diff stat master..extension tail -1 260 files changed, 4202 insertions(+), 2073 deletions(-) git no-pager diff stat extension..upgrade tail -1 125 files changed, 1976 insertions(+), 81 deletions(-) 5 patches, 7 branches, its own Commit Fest section about 18 months to get an agreement on what to develop first 2 Developer Meeting interventions, in Ottawa, PgCon 4 weeks full time, countless evenings, 3 months of refining

The effort in figures Scope Specs Implementation details... git diff stat master..extension tail -1 260 files changed, 4202 insertions(+), 2073 deletions(-) git no-pager diff stat extension..upgrade tail -1 125 files changed, 1976 insertions(+), 81 deletions(-) 5 patches, 7 branches, its own Commit Fest section about 18 months to get an agreement on what to develop first 2 Developer Meeting interventions, in Ottawa, PgCon 4 weeks full time, countless evenings, 3 months of refining

What s to know, now Scope Specs Implementation details... Some new commands and catalogs: CREATE EXTENSION hstore SCHEMA utils; CREATE EXTENSION hstore VERSION 1.1; \dx ALTER EXTENSION hstore SET SCHEMA addons; DROP EXTENSION hstore CASCADE; ALTER EXTENSION hstore UPDATE TO version ; CREATE EXTENSION hstore FROM unpackaged;

What s to know, now Scope Specs Implementation details... Some new commands and catalogs: CREATE EXTENSION hstore SCHEMA utils; CREATE EXTENSION hstore VERSION 1.1; \dx ALTER EXTENSION hstore SET SCHEMA addons; DROP EXTENSION hstore CASCADE; ALTER EXTENSION hstore UPDATE TO version ; CREATE EXTENSION hstore FROM unpackaged;

What s to know, now Scope Specs Implementation details... Some new commands and catalogs: CREATE EXTENSION hstore SCHEMA utils; CREATE EXTENSION hstore VERSION 1.1; \dx ALTER EXTENSION hstore SET SCHEMA addons; DROP EXTENSION hstore CASCADE; ALTER EXTENSION hstore UPDATE TO version ; CREATE EXTENSION hstore FROM unpackaged;

What s to know, now Scope Specs Implementation details... Some new commands and catalogs: CREATE EXTENSION hstore SCHEMA utils; CREATE EXTENSION hstore VERSION 1.1; \dx ALTER EXTENSION hstore SET SCHEMA addons; DROP EXTENSION hstore CASCADE; ALTER EXTENSION hstore UPDATE TO version ; CREATE EXTENSION hstore FROM unpackaged;

PGXS and the control file Extensions Upgrades Extensions and packaging PGXS and the control file

Using PGXS Agenda PGXS and the control file Extensions Upgrades Extensions and packaging Simpler way to have your files installed at the right place, using make install. But Makefiles are hard, right? Example (citext/makefile) MODULES = citext EXTENSION = citext DATA = citext--1.0.sql citext--unpackaged--1.0.sql REGRESS = citext

Using PGXS Agenda PGXS and the control file Extensions Upgrades Extensions and packaging Simpler way to have your files installed at the right place, using make install. But Makefiles are hard, right? Example (citext/makefile) MODULES = citext EXTENSION = citext DATA = citext--1.0.sql citext--unpackaged--1.0.sql REGRESS = citext

The control file Agenda PGXS and the control file Extensions Upgrades Extensions and packaging It s a very complex file containing the meta data that PostgreSQL needs to know about to be able to register your extension in its system catalogs. It looks like this: Example (citext.control) # citext extension comment = data type for case-insensitive character strings default_version = 1.0 module_pathname = $libdir/citext relocatable = true

The control file Agenda PGXS and the control file Extensions Upgrades Extensions and packaging It s a very complex file containing the meta data that PostgreSQL needs to know about to be able to register your extension in its system catalogs. It looks like this: Example (citext.control) # citext extension comment = data type for case-insensitive character strings default_version = 1.0 module_pathname = $libdir/citext relocatable = true

relocatable Agenda PGXS and the control file Extensions Upgrades Extensions and packaging A relocatable extension installs all its object into the first schema of the search_path. It s then possible to ALTER EXTENSION SET SCHEMA.

not relocatable Agenda PGXS and the control file Extensions Upgrades Extensions and packaging An extension that needs to know where some of its objects are installed is not relocatable. The extension installation script is then required to use the @extschema@ placeholer as the schema to work with. Example (tsearch2/tsearch2 unpackaged 1.0.sql) ALTER EXTENSION tsearch2 ADD type @extschema@.tsvector; ALTER EXTENSION tsearch2 ADD type @extschema@.tsquery;

Extension Configuration Tables PGXS and the control file Extensions Upgrades Extensions and packaging Example (Flag your pg_dump worthy objects) CREATE TABLE my_config (key text, value text); SELECT pg_catalog.pg_extension_config_dump( my_config, ); CREATE TABLE my_config (key text, value text, standard_entry SELECT pg_catalog.pg_extension_config_dump( my_config, WHERE NOT standard_entry );

PGXS and the control file Extensions Upgrades Extensions and packaging Extension Upgrades

ALTER EXTENSION... UPDATE; PGXS and the control file Extensions Upgrades Extensions and packaging Versions numbers are just strings Provide scripts extension old new.sql Updates only refer to changes in the SQL script Secondary control files extension new.control

ALTER EXTENSION... UPDATE; PGXS and the control file Extensions Upgrades Extensions and packaging Versions numbers are just strings Provide scripts extension old new.sql Updates only refer to changes in the SQL script Secondary control files extension new.control

ALTER EXTENSION... UPDATE; PGXS and the control file Extensions Upgrades Extensions and packaging Versions numbers are just strings Provide scripts extension old new.sql Updates only refer to changes in the SQL script Secondary control files extension new.control

ALTER EXTENSION... UPDATE; PGXS and the control file Extensions Upgrades Extensions and packaging Versions numbers are just strings Provide scripts extension old new.sql Updates only refer to changes in the SQL script Secondary control files extension new.control

PGXS and the control file Extensions Upgrades Extensions and packaging ALTER EXTENSION... UPDATE [TO VERSION]; system view pg_available_extensions system view pg_available_extension_versions CREATE EXTENSION... Example (hstore unpackaged 1.0.sql) FORM old_versions ALTER EXTENSION hstore ADD type hstore; ALTER EXTENSION hstore ADD function hstore_in(cstring); ALTER EXTENSION hstore ADD function hstore_out(hstore);...

Upgrade Scripts Agenda PGXS and the control file Extensions Upgrades Extensions and packaging Extension author has to provide scripts for all supported upgrades PostgreSQL handles upgrade paths 1.0 1.1 then 1.1 1.2 system view pg_available_extension_versions Be careful about downgrade paths!

PGXS and the control file Extensions Upgrades Extensions and packaging Extension and packaging

debian and pg_buildext PGXS and the control file Extensions Upgrades Extensions and packaging Contributed and available in debian squeeze, postgresql-server-dev-all Example (debian/pgversions) 8.4 9.0

debian and pg_buildext PGXS and the control file Extensions Upgrades Extensions and packaging Contributed and available in debian squeeze, postgresql-server-dev-all Example (debian/rules) include /usr/share/postgresql-common/pgxs_debian_control.mk install: build # build all supported version pg_buildext build $(SRCDIR) $(TARGET) "$(CFLAGS)" # then install each of them for v in pg_buildext supported-versions $(SRCDIR) ; do \ dh_install -ppostgresql-$$v-pgfincore ;\ done

Sponsoring Any question?

Money Agenda Sponsoring Any question? 4 week full time at home, thanks to 2ndQuadrant, and to our affiliation with European Research The research leading to these results has received funding from the European Union s Seventh Framework Programme (FP7/2007-2013) under grant agreement 258862

Any question? Agenda Sponsoring Any question? Now is a pretty good time to ask!