2019-05-31 21:33:42 +08:00
|
|
|
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;
|
|
|
|
|
2015-07-07 20:49:28 +08:00
|
|
|
CREATE TABLE pub(a int);
|
|
|
|
CREATE TABLE prv(a int);
|
|
|
|
GRANT SELECT ON TABLE pub TO publicuser;
|
|
|
|
REVOKE SELECT ON TABLE prv FROM publicuser;
|
2019-10-24 19:45:36 +08:00
|
|
|
SELECT cartodb.CDB_UserTables() ORDER BY 1;
|
|
|
|
SELECT 'all', cartodb.CDB_UserTables('all') ORDER BY 2;
|
|
|
|
SELECT 'public', cartodb.CDB_UserTables('public') ORDER BY 2;
|
|
|
|
SELECT 'private', cartodb.CDB_UserTables('private') ORDER BY 2;
|
|
|
|
SELECT '--unsupported--', cartodb.CDB_UserTables('--unsupported--') ORDER BY 2;
|
2015-07-27 16:25:44 +08:00
|
|
|
-- now tests with public user
|
|
|
|
\c contrib_regression publicuser
|
2019-10-24 19:45:36 +08:00
|
|
|
SELECT 'all_publicuser', cartodb.CDB_UserTables('all') ORDER BY 2;
|
|
|
|
SELECT 'public_publicuser', cartodb.CDB_UserTables('public') ORDER BY 2;
|
|
|
|
SELECT 'private_publicuser', cartodb.CDB_UserTables('private') ORDER BY 2;
|
2015-07-27 16:25:44 +08:00
|
|
|
\c contrib_regression postgres
|
2015-07-07 20:49:28 +08:00
|
|
|
DROP TABLE pub;
|
|
|
|
DROP TABLE prv;
|