@@ -868,6 +868,15 @@ ERROR: must be owner of hypertable "ht_try"
868868CREATE TABLE non_ht (time bigint, temp float);
869869SELECT _timescaledb_functions.attach_osm_table_chunk('non_ht', 'child_fdw_table');
870870ERROR: "non_ht" is not a hypertable
871+ -- TEST error have to be hypertable owner to drop the OSM chunk
872+ SELECT _timescaledb_functions.drop_osm_chunk('ht_try');
873+ ERROR: must be owner of hypertable "ht_try"
874+ -- TEST error have to be hypertable owner to update the OSM chunk range
875+ SELECT _timescaledb_functions.hypertable_osm_range_update('ht_try', NULL::timestamptz, NULL::timestamptz);
876+ ERROR: must be owner of hypertable "ht_try"
877+ -- TEST error have to be hypertable owner to lock the OSM chunk dimension slice
878+ SELECT _timescaledb_functions.lock_osm_chunk_dimension_slice('ht_try');
879+ ERROR: must be owner of hypertable "ht_try"
871880-- TEST drop OSM chunk
872881\c :TEST_DBNAME :ROLE_4
873882-- We need the OSM chunk for other tests so we run the test in a single
@@ -1886,3 +1895,22 @@ SELECT compress_chunk(ch) FROM show_chunks('metrics') ch;
18861895ERROR: chunk "_timescaledb_internal._hyper_25_43_chunk" is frozen, skipping compression
18871896ROLLBACK;
18881897\set ON_ERROR_STOP 1
1898+ -- A non-owner must not be able to freeze or unfreeze a chunk
1899+ \c :TEST_DBNAME :ROLE_SUPERUSER
1900+ CREATE TABLE freeze_perm(time timestamptz NOT NULL);
1901+ SELECT create_hypertable('freeze_perm', 'time');
1902+ create_hypertable
1903+ ---------------------------
1904+ (26,public,freeze_perm,t)
1905+
1906+ INSERT INTO freeze_perm VALUES ('2025-01-01');
1907+ SELECT ch AS "FREEZECHUNK" FROM show_chunks('freeze_perm') ch \gset
1908+ \c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER
1909+ \set ON_ERROR_STOP 0
1910+ SELECT _timescaledb_functions.freeze_chunk(:'FREEZECHUNK');
1911+ ERROR: must be owner of hypertable "freeze_perm"
1912+ SELECT _timescaledb_functions.unfreeze_chunk(:'FREEZECHUNK');
1913+ ERROR: must be owner of hypertable "freeze_perm"
1914+ \set ON_ERROR_STOP 1
1915+ \c :TEST_DBNAME :ROLE_SUPERUSER
1916+ DROP TABLE freeze_perm;
0 commit comments