From 84e33e62f935a7aa4fced1f894fc90a0376fbe9c Mon Sep 17 00:00:00 2001 From: Shigeru Hanada Date: Thu, 24 Feb 2011 21:06:39 +0900 Subject: [PATCH] Convert postgresql_fdw to an EXTENSION. --- contrib/README | 3 +++ contrib/postgresql_fdw/Makefile | 7 ++++--- contrib/postgresql_fdw/expected/postgresql_fdw.out | 10 +++------- ...postgresql_fdw.sql.in => postgresql_fdw--1.0.sql} | 5 +---- contrib/postgresql_fdw/postgresql_fdw.control | 5 +++++ contrib/postgresql_fdw/sql/postgresql_fdw.sql | 12 +++--------- 6 files changed, 19 insertions(+), 23 deletions(-) rename contrib/postgresql_fdw/{postgresql_fdw.sql.in => postgresql_fdw--1.0.sql} (65%) create mode 100644 contrib/postgresql_fdw/postgresql_fdw.control diff --git a/contrib/README b/contrib/README index 9bd1b137e6..e6d565fc51 100644 --- a/contrib/README +++ b/contrib/README @@ -163,6 +163,9 @@ pgstattuple - space within a table by Tatsuo Ishii +postgresql_fdw - + Foreign-data wrapper for external PostgreSQL server. + seg - Confidence-interval datatype (GiST indexing example) by Gene Selkov, Jr. diff --git a/contrib/postgresql_fdw/Makefile b/contrib/postgresql_fdw/Makefile index b9cf9ec5e6..da3c845a08 100644 --- a/contrib/postgresql_fdw/Makefile +++ b/contrib/postgresql_fdw/Makefile @@ -4,11 +4,12 @@ MODULE_big = postgresql_fdw PG_CPPFLAGS = -I$(libpq_srcdir) OBJS = postgresql_fdw.o SHLIB_LINK = $(libpq) +SHLIB_PREREQS = submake-libpq -DATA_built = postgresql_fdw.sql -DATA = uninstall_postgresql_fdw.sql -REGRESS = postgresql_fdw +EXTENSION = postgresql_fdw +DATA = postgresql_fdw--1.0.sql postgresql_fdw--unpachaged--1.0.sql +REGRESS = postgresql_fdw ifdef USE_PGXS PG_CONFIG = pg_config diff --git a/contrib/postgresql_fdw/expected/postgresql_fdw.out b/contrib/postgresql_fdw/expected/postgresql_fdw.out index 91cd6c10c7..05b3914245 100644 --- a/contrib/postgresql_fdw/expected/postgresql_fdw.out +++ b/contrib/postgresql_fdw/expected/postgresql_fdw.out @@ -1,14 +1,10 @@ -SET SEARCH_PATH = public; SET DATESTYLE = 'Postgres, MDY'; -- ============================================================================= -- Prepare section -- ============================================================================= +CREATE EXTENSION postgresql_fdw; -- connect database for regression test \c contrib_regression --- install postgresql_fdw module -SET client_min_messages = warning; -\set ECHO none -RESET client_min_messages; -- define fdw-related objects CREATE SERVER loopback1 FOREIGN DATA WRAPPER postgresql_fdw OPTIONS (dbname 'contrib_regression'); @@ -134,7 +130,8 @@ EXECUTE st(2); DEALLOCATE st; -- clean up -DROP FOREIGN DATA WRAPPER postgresql_fdw CASCADE; +DROP TABLE t1 CASCADE; +DROP EXTENSION postgresql_fdw CASCADE; NOTICE: drop cascades to 6 other objects DETAIL: drop cascades to server loopback1 drop cascades to user mapping for public @@ -142,4 +139,3 @@ drop cascades to foreign table ft1 drop cascades to server loopback2 drop cascades to user mapping for public drop cascades to foreign table ft2 -DROP TABLE t1 CASCADE; diff --git a/contrib/postgresql_fdw/postgresql_fdw.sql.in b/contrib/postgresql_fdw/postgresql_fdw--1.0.sql similarity index 65% rename from contrib/postgresql_fdw/postgresql_fdw.sql.in rename to contrib/postgresql_fdw/postgresql_fdw--1.0.sql index 93d5926200..37facd424e 100644 --- a/contrib/postgresql_fdw/postgresql_fdw.sql.in +++ b/contrib/postgresql_fdw/postgresql_fdw--1.0.sql @@ -1,7 +1,4 @@ -/* contrib/postgresql/postgresql.sql.in */ - --- Adjust this setting to control where the objects get created. -set search_path = public; +/* contrib/postgresql_fdw/postgresql_fdw--1.0.sql */ CREATE OR REPLACE FUNCTION postgresql_fdw_handler () RETURNS fdw_handler diff --git a/contrib/postgresql_fdw/postgresql_fdw.control b/contrib/postgresql_fdw/postgresql_fdw.control new file mode 100644 index 0000000000..ef78aafefd --- /dev/null +++ b/contrib/postgresql_fdw/postgresql_fdw.control @@ -0,0 +1,5 @@ +# postgresql_fdw extension +comment = 'Foreign-data wrapepr for external PostgreSQL server' +default_version = '1.0' +module_pathname = '$libdir/postgresql_fdw' +relocatable = true diff --git a/contrib/postgresql_fdw/sql/postgresql_fdw.sql b/contrib/postgresql_fdw/sql/postgresql_fdw.sql index a9632078cb..eee9ff95f4 100644 --- a/contrib/postgresql_fdw/sql/postgresql_fdw.sql +++ b/contrib/postgresql_fdw/sql/postgresql_fdw.sql @@ -1,19 +1,13 @@ -SET SEARCH_PATH = public; SET DATESTYLE = 'Postgres, MDY'; -- ============================================================================= -- Prepare section -- ============================================================================= +CREATE EXTENSION postgresql_fdw; + -- connect database for regression test \c contrib_regression --- install postgresql_fdw module -SET client_min_messages = warning; -\set ECHO none -\i postgresql_fdw.sql -\set ECHO all -RESET client_min_messages; - -- define fdw-related objects CREATE SERVER loopback1 FOREIGN DATA WRAPPER postgresql_fdw OPTIONS (dbname 'contrib_regression'); @@ -86,5 +80,5 @@ EXECUTE st(2); DEALLOCATE st; -- clean up -DROP FOREIGN DATA WRAPPER postgresql_fdw CASCADE; DROP TABLE t1 CASCADE; +DROP EXTENSION postgresql_fdw CASCADE; -- 2.39.5