]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-5765: Finishing up leftover work on the ID Generators table creation SQL script.
authorAron Roberts <aron@socrates.berkeley.edu>
Thu, 3 Jan 2013 03:23:18 +0000 (19:23 -0800)
committerAron Roberts <aron@socrates.berkeley.edu>
Thu, 3 Jan 2013 03:23:18 +0000 (19:23 -0800)
services/common/src/main/resources/db/postgresql/create_id_generators_table.sql

index d087fd5fe1c60b956f6e6f7afbd95ff59438e40a..7b4598341be3d31b23d51f488b205bb9a167c4f4 100644 (file)
  *
  * Creates the "id_generators" table, used by the ID Service,
  * and sets the access permissions of that table.
- *
- * $LastChangedRevision$
- * $LastChangedDate$
  */
 
--- DROP TABLE IF EXISTS id_generators;
+-- Temporarily suppress messages of NOTICE level and below
+SET SESSION client_min_messages=WARNING;
 
--- 'CREATE TABLE ... IF NOT EXISTS' requires PostgreSQL 9.1 or later
+-- 'CREATE TABLE ... IF NOT EXISTS' requires PostgreSQL 9.1 or later.
+--
+-- To adapt this script for use with PostgreSQL 9.0 or earlier (untested),
+-- try substituting the following two lines for the line below:
+-- DROP TABLE IF EXISTS id_generators;
+-- CREATE TABLE id_generators ...
+--
 CREATE TABLE IF NOT EXISTS id_generators
 (
   csid character varying(80) NOT NULL,
@@ -39,7 +43,7 @@ CREATE TABLE IF NOT EXISTS id_generators
   modified timestamp without time zone NOT NULL DEFAULT now(),
   CONSTRAINT id_generators_pkey PRIMARY KEY (csid)
 ) WITH (
-  OIDS=FALSE -- See http://www.postgresql.org/docs/8.4/static/sql-createtable.html
+  OIDS=FALSE -- See "Notes" on http://www.postgresql.org/docs/9.1/static/sql-createtable.html
 );
 
 CREATE OR REPLACE FUNCTION update_modified_column()
@@ -47,6 +51,7 @@ CREATE OR REPLACE FUNCTION update_modified_column()
     'BEGIN NEW.modified = now(); RETURN NEW; END;'
     LANGUAGE 'plpgsql';
 
+DROP TRIGGER IF EXISTS update_customer_modtime ON id_generators;
 CREATE TRIGGER update_customer_modtime BEFORE UPDATE
     ON id_generators FOR EACH ROW EXECUTE PROCEDURE 
     update_modified_column();