timescaledb/test/sql/trusted_extension.sql
Mats Kindahl e320679c4c Remove grants on data node bootstrap
Starting with PG15, default permissions on the public schema is
restricted for any non-superuser non-owner. This causes test failures
since tables can no longer be created without explicitly adding
permissions, so we remove grant when bootstrapping the data nodes and
instead grant permissions to the users in the regression tests. This
keeps the default permissions on data nodes, but allow regression tests
to run.

Fixes #3957

Reference: https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=b073c3cc
2022-01-17 17:36:33 +01:00

35 lines
951 B
SQL

-- This file and its contents are licensed under the Apache License 2.0.
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.
\c :TEST_DBNAME :ROLE_SUPERUSER
CREATE DATABASE trusted_test;
GRANT CREATE ON DATABASE trusted_test TO :ROLE_1;
\c trusted_test :ROLE_READ_ONLY
\set ON_ERROR_STOP 0
CREATE EXTENSION timescaledb;
\set ON_ERROR_STOP 1
\c trusted_test :ROLE_1
-- user shouldn't have superuser privilege
SELECT rolsuper FROM pg_roles WHERE rolname=user;
SET client_min_messages TO ERROR;
CREATE EXTENSION timescaledb;
RESET client_min_messages;
CREATE TABLE t(time timestamptz);
SELECT create_hypertable('t','time');
INSERT INTO t VALUES ('2000-01-01'), ('2001-01-01');
SELECT * FROM t ORDER BY 1;
SELECT * FROM timescaledb_information.hypertables;
\dt+ _timescaledb_internal._hyper_*
DROP EXTENSION timescaledb CASCADE;
\c :TEST_DBNAME :ROLE_SUPERUSER
DROP DATABASE trusted_test;