Code

Added support for installing PostRR as an extension.
[postrr.git] / src / postrr.sql.in
index a3bff336ae94ef5288b4ab927a7a3c4704359d83..34d125773fa4da1cacc7864657899956af5ee41a 100644 (file)
 -- 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;
 
@@ -45,6 +43,8 @@ CREATE TABLE postrr.rrtimeslices (
        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,
@@ -53,6 +53,8 @@ CREATE TABLE postrr.rrarchives (
        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'
@@ -408,9 +410,5 @@ BEGIN
 END;
 $$;
 
-COMMIT;
-
-SET client_min_messages TO DEFAULT;
-
 -- vim: set tw=78 sw=4 ts=4 noexpandtab :