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:
@@ -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 pub(a int);
|
||||||
CREATE TABLE prv(a int);
|
CREATE TABLE prv(a int);
|
||||||
GRANT SELECT ON TABLE pub TO publicuser;
|
GRANT SELECT ON TABLE pub TO publicuser;
|
||||||
@@ -16,4 +30,3 @@ SELECT 'private_publicuser',CDB_UserTables('private') ORDER BY 2;
|
|||||||
\c contrib_regression postgres
|
\c contrib_regression postgres
|
||||||
DROP TABLE pub;
|
DROP TABLE pub;
|
||||||
DROP TABLE prv;
|
DROP TABLE prv;
|
||||||
DROP ROLE publicuser;
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
CREATE ROLE
|
SET
|
||||||
|
DO
|
||||||
|
SET
|
||||||
CREATE TABLE
|
CREATE TABLE
|
||||||
CREATE TABLE
|
CREATE TABLE
|
||||||
GRANT
|
GRANT
|
||||||
@@ -15,4 +17,3 @@ public_publicuser|pub
|
|||||||
You are now connected to database "contrib_regression" as user "postgres".
|
You are now connected to database "contrib_regression" as user "postgres".
|
||||||
DROP TABLE
|
DROP TABLE
|
||||||
DROP TABLE
|
DROP TABLE
|
||||||
DROP ROLE
|
|
||||||
|
|||||||
Reference in New Issue
Block a user