summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 25f71c2)
raw | patch | inline | side by side (parent: 25f71c2)
author | Sebastian Harl <sh@tokkee.org> | |
Mon, 12 Nov 2012 20:24:11 +0000 (21:24 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Mon, 12 Nov 2012 20:24:11 +0000 (21:24 +0100) |
* Added initial control file (generated by configure from .in)
* Moved postrr.sql to postrr--VERSION.sql
* Abort, if the SQL file is loaded directly (-> force the use of the
extension)
* Simply use 'DROP EXTENSION' in uninstall_postrr.sql
* Moved postrr.sql to postrr--VERSION.sql
* Abort, if the SQL file is loaded directly (-> force the use of the
extension)
* Simply use 'DROP EXTENSION' in uninstall_postrr.sql
.gitignore | patch | blob | history | |
configure.ac | patch | blob | history | |
src/Makefile.pgxs.in | patch | blob | history | |
src/postrr.control.in | [new file with mode: 0644] | patch | blob |
src/postrr.sql.in | patch | blob | history | |
src/uninstall_postrr.sql | patch | blob | history |
diff --git a/.gitignore b/.gitignore
index 6848d40571bcb31ad5b41f7c7b1dc89ed537f4ee..ce4ac14c203ea3a1b17c23ecf8db401ec2ee79a4 100644 (file)
--- a/.gitignore
+++ b/.gitignore
*.lo
*.o
postrr.7
+postrr.control
postrr.h
postrr.sql
+postrr--*.sql
postrr-*.so
diff --git a/configure.ac b/configure.ac
index 613595b10b669c4d2d8aa50ef41f25ffc1f19bba..cf16d83d45320de5d03b8a56ee59274558e59c75 100644 (file)
--- a/configure.ac
+++ b/configure.ac
AC_CONFIG_FILES([Makefile doc/Makefile
src/Makefile src/Makefile.pgxs
- src/postrr.sql])
+ src/postrr.sql src/postrr.control])
AC_OUTPUT
AC_MSG_RESULT()
diff --git a/src/Makefile.pgxs.in b/src/Makefile.pgxs.in
index f223061c439fa8fde40b8bdc29cac92cb2d8ff27..a91f7bd911606a4ed0edd8ddc5d5977a5b8207a3 100644 (file)
--- a/src/Makefile.pgxs.in
+++ b/src/Makefile.pgxs.in
PG_CPPFLAGS = @STRICT_CPPFLAGS@ -I@abs_builddir@
MODULE_big=postrr-@POSTRR_MAJOR_VERSION@.@POSTRR_MINOR_VERSION@
-MODULEDIR=contrib/$(MODULE)
PG_OBJS=base.o \
cdata.o \
rrtimeslice.o \
utils/pg_spi.o
+EXTENSION=postrr
+
DATA=postrr_comments.sql uninstall_postrr.sql
-DATA_built=postrr.sql
+DATA_built=postrr--@POSTRR_MAJOR_VERSION@.@POSTRR_MINOR_VERSION@.@POSTRR_PATCH_VERSION@.sql
# objects to be build by PGXS
OBJS=$(PG_OBJS)
PGXS=@PGXS@
include $(PGXS)
+postrr--@POSTRR_MAJOR_VERSION@.@POSTRR_MINOR_VERSION@.@POSTRR_PATCH_VERSION@.sql: postrr.sql
+ cp $< $@
+
diff --git a/src/postrr.control.in b/src/postrr.control.in
--- /dev/null
+++ b/src/postrr.control.in
@@ -0,0 +1,6 @@
+# PostRR extension
+comment = 'PostgreSQL Round Robin Extension'
+default_version = '@POSTRR_MAJOR_VERSION@.@POSTRR_MINOR_VERSION@.@POSTRR_PATCH_VERSION@'
+module_pathname = '$libdir/postrr'
+superuser = false
+
diff --git a/src/postrr.sql.in b/src/postrr.sql.in
index a3bff336ae94ef5288b4ab927a7a3c4704359d83..34d125773fa4da1cacc7864657899956af5ee41a 100644 (file)
--- a/src/postrr.sql.in
+++ b/src/postrr.sql.in
-- PostRR - PostgreSQL Round-Robin Extension
--
--- suppress messages like 'return type foo is only a shell'
-SET client_min_messages TO WARNING;
-
-BEGIN;
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION postrr" to load this file. \quit
CREATE SCHEMA postrr;
tsnum integer NOT NULL
);
+SELECT pg_catalog.pg_extension_config_dump('postrr.rrtimeslices', '');
+
CREATE TABLE postrr.rrarchives (
rraname text NOT NULL,
tbl name NOT NULL,
UNIQUE (rraname, tbl, tscol, vcol)
);
+SELECT pg_catalog.pg_extension_config_dump('postrr.rrarchives', '');
+
CREATE OR REPLACE FUNCTION PostRR_Version()
RETURNS cstring
AS 'postrr-@POSTRR_MAJOR_VERSION@.@POSTRR_MINOR_VERSION@', 'postrr_version'
END;
$$;
-COMMIT;
-
-SET client_min_messages TO DEFAULT;
-
-- vim: set tw=78 sw=4 ts=4 noexpandtab :
index 088309cd113fc9dfbc267ef80157243c5816b965..5bb3519c60c1d657d321c5428201aefddca11489 100644 (file)
--- a/src/uninstall_postrr.sql
+++ b/src/uninstall_postrr.sql
-- PostRR - PostgreSQL Round-Robin Extension
--
-SET client_min_messages TO WARNING;
-
-DROP FUNCTION IF EXISTS RRTimeslice_validate(integer);
-
-DROP CAST IF EXISTS (rrtimeslice AS rrtimeslice);
-DROP FUNCTION IF EXISTS RRTimeslice(rrtimeslice, integer, boolean);
-DROP CAST IF EXISTS (rrtimeslice AS timestamp);
-DROP FUNCTION IF EXISTS Tstamp(rrtimeslice);
-DROP TYPE RRTimeslice CASCADE;
-DROP FUNCTION IF EXISTS RRTimeslice_typmodin(cstring[]);
-DROP FUNCTION IF EXISTS RRTimeslice_typmodout(integer);
-
-DROP FUNCTION IF EXISTS CData_validate(integer);
-
-DROP CAST IF EXISTS (cdata AS cdata);
-DROP FUNCTION IF EXISTS CData(cdata, integer, boolean);
-DROP TYPE CData CASCADE;
-DROP FUNCTION IF EXISTS CData_typmodin(cstring[]);
-DROP FUNCTION IF EXISTS CData_typmodout(integer);
-
-DROP FUNCTION IF EXISTS PostRR_Version();
-
-DROP TABLE postrr.rrtimeslices;
-DROP SEQUENCE postrr.tsid;
-
-DROP TABLE postrr.rrarchives;
-
-DROP SCHEMA postrr;
-
-SET client_min_messages TO DEFAULT;
+DROP EXTENSION postrr;
-- vim: set tw=78 sw=4 ts=4 noexpandtab :