-
-
-- Generated 2015-04-21 10:41:11 on db03.eg.kcls.org
--- These custom users may already exist... errors are OK.
-
BEGIN;
-CREATE USER bbonner;
-CREATE USER biblio;
-CREATE USER kclsreporter;
-CREATE USER kclsreporter2;
-
-
\set ON_ERROR_STOP on
+DO
+$BODY$
+BEGIN
+ -- When deploying to an existing postgres instance,
+ -- these users may already exist.
+ IF NOT EXISTS (
+ SELECT *
+ FROM pg_catalog.pg_user
+ WHERE usename = 'bbonner') THEN
+ -- if bbonner is not present, assume the other's aren't.
+ CREATE USER bbonner;
+ CREATE USER biblio;
+ CREATE USER kclsreporter;
+ CREATE USER kclsreporter2;
+ END IF;
+END
+$BODY$;
+
--
-- PostgreSQL database dump