mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-15 01:53:41 +08:00
Add weird user names to update test
Since we want to be able to handle update of weird user names we add some to the update tests and create policies on them. This will create jobs with the strange name as owner.
This commit is contained in:
parent
07762ea4ce
commit
8a2b6a03e0
2
.unreleased/PR_5930
Normal file
2
.unreleased/PR_5930
Normal file
@ -0,0 +1,2 @@
|
||||
Fixes: #5930 Add update tests with weird user names for jobs
|
||||
Thanks: @mrksngl for discovering and reporting the issue
|
@ -7,6 +7,17 @@ SELECT table_name FROM create_hypertable('policy_test_timestamptz','time');
|
||||
|
||||
ALTER TABLE policy_test_timestamptz SET (timescaledb.compress);
|
||||
|
||||
SELECT
|
||||
(string_to_array(extversion,'.'))[1] AS ts_major,
|
||||
(string_to_array(extversion,'.'))[2] AS ts_minor
|
||||
FROM pg_extension
|
||||
WHERE extname = 'timescaledb' \gset
|
||||
|
||||
SELECT
|
||||
:ts_major < 2 AS has_drop_chunks_policy
|
||||
FROM pg_extension
|
||||
WHERE extname = 'timescaledb' \gset
|
||||
|
||||
DO LANGUAGE PLPGSQL $$
|
||||
DECLARE
|
||||
ts_version TEXT;
|
||||
@ -27,3 +38,28 @@ BEGIN
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
|
||||
\if :WITH_ROLES
|
||||
-- For PostgreSQL 15 and later
|
||||
GRANT ALL ON SCHEMA PUBLIC TO "dotted.name";
|
||||
GRANT ALL ON SCHEMA PUBLIC TO "Kim Possible";
|
||||
|
||||
SET ROLE "dotted.name";
|
||||
CREATE TABLE policy_test_user_1(time timestamptz not null, device_id int, value float);
|
||||
SELECT table_name FROM create_hypertable('policy_test_user_1','time');
|
||||
\if :has_drop_chunks_policy
|
||||
SELECT add_drop_chunks_policy('policy_test_user_1', '14 days'::interval);
|
||||
\else
|
||||
SELECT add_retention_policy('policy_test_user_1', '14 days'::interval);
|
||||
\endif
|
||||
|
||||
SET ROLE "Kim Possible";
|
||||
CREATE TABLE policy_test_user_2(time timestamptz not null, device_id int, value float);
|
||||
SELECT table_name FROM create_hypertable('policy_test_user_2','time');
|
||||
\if :has_drop_chunks_policy
|
||||
SELECT add_drop_chunks_policy('policy_test_user_2', '14 days'::interval);
|
||||
\else
|
||||
SELECT add_retention_policy('policy_test_user_2', '14 days'::interval);
|
||||
\endif
|
||||
RESET ROLE;
|
||||
\endif
|
||||
|
@ -4,3 +4,7 @@
|
||||
|
||||
CREATE ROLE cagg_user;
|
||||
CREATE USER tsdbadmin;
|
||||
|
||||
-- These are used to test job creation and updating job owners.
|
||||
CREATE USER "dotted.name"; --non-identifier character in name
|
||||
CREATE USER "Kim Possible"; --case-sensitive names
|
||||
|
Loading…
x
Reference in New Issue
Block a user