summaryrefslogtreecommitdiff
path: root/contrib/tablefunc
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-02-13 20:06:41 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2011-02-13 22:54:49 -0500
commit629b3af27d5c2bc9d6e16b22b943ad651d4ecb56 (patch)
treeeae9ef9a69ae6ad7aacb2428e3cf15ec77873ac5 /contrib/tablefunc
parente693e97d754ed6812ea115170afeae4bf8797d3f (diff)
downloadpostgresql-629b3af27d5c2bc9d6e16b22b943ad651d4ecb56.tar.gz
Convert contrib modules to use the extension facility.
This isn't fully tested as yet, in particular I'm not sure that the "foo--unpackaged--1.0.sql" scripts are OK. But it's time to get some buildfarm cycles on it. sepgsql is not converted to an extension, mainly because it seems to require a very nonstandard installation process. Dimitri Fontaine and Tom Lane
Diffstat (limited to 'contrib/tablefunc')
-rw-r--r--contrib/tablefunc/.gitignore1
-rw-r--r--contrib/tablefunc/Makefile6
-rw-r--r--contrib/tablefunc/expected/tablefunc.out8
-rw-r--r--contrib/tablefunc/sql/tablefunc.sql10
-rw-r--r--contrib/tablefunc/tablefunc--1.0.sql (renamed from contrib/tablefunc/tablefunc.sql.in)5
-rw-r--r--contrib/tablefunc/tablefunc--unpackaged--1.0.sql16
-rw-r--r--contrib/tablefunc/tablefunc.control5
-rw-r--r--contrib/tablefunc/uninstall_tablefunc.sql32
8 files changed, 28 insertions, 55 deletions
diff --git a/contrib/tablefunc/.gitignore b/contrib/tablefunc/.gitignore
index b28639637b..19b6c5ba42 100644
--- a/contrib/tablefunc/.gitignore
+++ b/contrib/tablefunc/.gitignore
@@ -1,3 +1,2 @@
-/tablefunc.sql
# Generated subdirectories
/results/
diff --git a/contrib/tablefunc/Makefile b/contrib/tablefunc/Makefile
index a5c2882866..eb108931ec 100644
--- a/contrib/tablefunc/Makefile
+++ b/contrib/tablefunc/Makefile
@@ -1,8 +1,10 @@
# contrib/tablefunc/Makefile
MODULES = tablefunc
-DATA_built = tablefunc.sql
-DATA = uninstall_tablefunc.sql
+
+EXTENSION = tablefunc
+DATA = tablefunc--1.0.sql tablefunc--unpackaged--1.0.sql
+
REGRESS = tablefunc
LDFLAGS_SL += $(filter -lm, $(LIBS))
diff --git a/contrib/tablefunc/expected/tablefunc.out b/contrib/tablefunc/expected/tablefunc.out
index 15ef758ed7..7ad4336ada 100644
--- a/contrib/tablefunc/expected/tablefunc.out
+++ b/contrib/tablefunc/expected/tablefunc.out
@@ -1,10 +1,4 @@
---
--- first, define the functions. Turn off echoing so that expected file
--- does not depend on contents of tablefunc.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION tablefunc;
--
-- normal_rand()
-- no easy way to do this for regression testing
diff --git a/contrib/tablefunc/sql/tablefunc.sql b/contrib/tablefunc/sql/tablefunc.sql
index 8846a4218e..bf874f26ad 100644
--- a/contrib/tablefunc/sql/tablefunc.sql
+++ b/contrib/tablefunc/sql/tablefunc.sql
@@ -1,12 +1,4 @@
---
--- first, define the functions. Turn off echoing so that expected file
--- does not depend on contents of tablefunc.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i tablefunc.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION tablefunc;
--
-- normal_rand()
diff --git a/contrib/tablefunc/tablefunc.sql.in b/contrib/tablefunc/tablefunc--1.0.sql
index 54cba5ed3e..63dd8c4634 100644
--- a/contrib/tablefunc/tablefunc.sql.in
+++ b/contrib/tablefunc/tablefunc--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/tablefunc/tablefunc.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/tablefunc/tablefunc--1.0.sql */
CREATE OR REPLACE FUNCTION normal_rand(int4, float8, float8)
RETURNS setof float8
diff --git a/contrib/tablefunc/tablefunc--unpackaged--1.0.sql b/contrib/tablefunc/tablefunc--unpackaged--1.0.sql
new file mode 100644
index 0000000000..20e09816e9
--- /dev/null
+++ b/contrib/tablefunc/tablefunc--unpackaged--1.0.sql
@@ -0,0 +1,16 @@
+/* contrib/tablefunc/tablefunc--unpackaged--1.0.sql */
+
+ALTER EXTENSION tablefunc ADD function normal_rand(integer,double precision,double precision);
+ALTER EXTENSION tablefunc ADD function crosstab(text);
+ALTER EXTENSION tablefunc ADD type tablefunc_crosstab_2;
+ALTER EXTENSION tablefunc ADD type tablefunc_crosstab_3;
+ALTER EXTENSION tablefunc ADD type tablefunc_crosstab_4;
+ALTER EXTENSION tablefunc ADD function crosstab2(text);
+ALTER EXTENSION tablefunc ADD function crosstab3(text);
+ALTER EXTENSION tablefunc ADD function crosstab4(text);
+ALTER EXTENSION tablefunc ADD function crosstab(text,integer);
+ALTER EXTENSION tablefunc ADD function crosstab(text,text);
+ALTER EXTENSION tablefunc ADD function connectby(text,text,text,text,integer,text);
+ALTER EXTENSION tablefunc ADD function connectby(text,text,text,text,integer);
+ALTER EXTENSION tablefunc ADD function connectby(text,text,text,text,text,integer,text);
+ALTER EXTENSION tablefunc ADD function connectby(text,text,text,text,text,integer);
diff --git a/contrib/tablefunc/tablefunc.control b/contrib/tablefunc/tablefunc.control
new file mode 100644
index 0000000000..248b0a77a2
--- /dev/null
+++ b/contrib/tablefunc/tablefunc.control
@@ -0,0 +1,5 @@
+# tablefunc extension
+comment = 'functions that manipulate whole tables, including crosstab'
+default_version = '1.0'
+module_pathname = '$libdir/tablefunc'
+relocatable = true
diff --git a/contrib/tablefunc/uninstall_tablefunc.sql b/contrib/tablefunc/uninstall_tablefunc.sql
deleted file mode 100644
index b1ec916447..0000000000
--- a/contrib/tablefunc/uninstall_tablefunc.sql
+++ /dev/null
@@ -1,32 +0,0 @@
-/* contrib/tablefunc/uninstall_tablefunc.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP FUNCTION connectby(text,text,text,text,text,int);
-
-DROP FUNCTION connectby(text,text,text,text,text,int,text);
-
-DROP FUNCTION connectby(text,text,text,text,int);
-
-DROP FUNCTION connectby(text,text,text,text,int,text);
-
-DROP FUNCTION crosstab(text,text);
-
-DROP FUNCTION crosstab(text,int);
-
-DROP FUNCTION crosstab4(text);
-
-DROP FUNCTION crosstab3(text);
-
-DROP FUNCTION crosstab2(text);
-
-DROP TYPE tablefunc_crosstab_4;
-
-DROP TYPE tablefunc_crosstab_3;
-
-DROP TYPE tablefunc_crosstab_2;
-
-DROP FUNCTION crosstab(text);
-
-DROP FUNCTION normal_rand(int4, float8, float8);