From 966dd4268a05b854394d4350310e3e586eb0f59c Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Mon, 8 Aug 2016 15:24:21 +0200 Subject: [PATCH] Create role publicuser if it does not exist --- src/pg/test/expected/01_install_test.out | 13 +++++++++++++ src/pg/test/sql/01_install_test.sql | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/pg/test/expected/01_install_test.out b/src/pg/test/expected/01_install_test.out index e84a48a..79ff047 100644 --- a/src/pg/test/expected/01_install_test.out +++ b/src/pg/test/expected/01_install_test.out @@ -1,5 +1,18 @@ -- Install dependencies CREATE EXTENSION plpythonu; CREATE EXTENSION postgis; +-- Create role publicuser if it does not exist +DO +$$ +BEGIN + IF NOT EXISTS ( + SELECT * + FROM pg_catalog.pg_user + WHERE usename = 'publicuser') THEN + + CREATE ROLE publicuser LOGIN; + END IF; +END +$$ LANGUAGE plpgsql; -- Install the extension CREATE EXTENSION crankshaft VERSION 'dev'; diff --git a/src/pg/test/sql/01_install_test.sql b/src/pg/test/sql/01_install_test.sql index bbce805..98d7db4 100644 --- a/src/pg/test/sql/01_install_test.sql +++ b/src/pg/test/sql/01_install_test.sql @@ -2,5 +2,19 @@ CREATE EXTENSION plpythonu; CREATE EXTENSION postgis; +-- Create role publicuser if it does not exist +DO +$$ +BEGIN + IF NOT EXISTS ( + SELECT * + FROM pg_catalog.pg_user + WHERE usename = 'publicuser') THEN + + CREATE ROLE publicuser LOGIN; + END IF; +END +$$ LANGUAGE plpgsql; + -- Install the extension CREATE EXTENSION crankshaft VERSION 'dev';