Tests: Only create publicuser if necessary

Also, don't try to drop it since it's used by default
CARTO installation
This commit is contained in:
Raul Marin
2019-05-31 15:33:42 +02:00
parent 78077a6ec1
commit 06f563bb73
2 changed files with 18 additions and 4 deletions

View File

@@ -1,4 +1,18 @@
CREATE ROLE publicuser LOGIN;
SET client_min_messages TO ERROR;
DO
$do$
BEGIN
IF NOT EXISTS (
SELECT *
FROM pg_catalog.pg_user
WHERE usename = 'publicuser') THEN
CREATE ROLE publicuser LOGIN;
END IF;
END
$do$;
SET client_min_messages TO NOTICE;
CREATE TABLE pub(a int);
CREATE TABLE prv(a int);
GRANT SELECT ON TABLE pub TO publicuser;
@@ -16,4 +30,3 @@ SELECT 'private_publicuser',CDB_UserTables('private') ORDER BY 2;
\c contrib_regression postgres
DROP TABLE pub;
DROP TABLE prv;
DROP ROLE publicuser;