Content-Length: 273489 | pFad | http://github.com/timescale/timescaledb/commit/a47ff5c72c495a331635c90e2712ac3c15372a32

25 Block dropping internal compressed chunks · timescale/timescaledb@a47ff5c · GitHub
Skip to content

Commit

Permalink
Block dropping internal compressed chunks
Browse files Browse the repository at this point in the history
Dropping internal compressed chunks is blocked on DDL level, but
is still possible with `_timescaledb_functions.drop_chunk` function.
This patch adds a simple check to prevent that.
  • Loading branch information
zilder committed Feb 12, 2025
1 parent ef00d91 commit a47ff5c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -4044,6 +4044,14 @@ ts_chunk_drop_single_chunk(PG_FUNCTION_ARGS)
true);
Assert(ch != NULL);
ts_chunk_validate_chunk_status_for_operation(ch, CHUNK_DROP, true /*throw_error */);

if (ts_chunk_contains_compressed_data(ch))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("dropping compressed chunks not supported"),
errhint("Please drop the corresponding chunk on the uncompressed hypertable "
"instead.")));

/* do not drop any chunk dependencies */
ts_chunk_drop(ch, DROP_RESTRICT, LOG);
PG_RETURN_BOOL(true);
Expand Down
2 changes: 2 additions & 0 deletions tsl/test/expected/compression_ddl.out
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ WHERE uncomp_hyper.table_name like 'test1' ORDER BY chunk.id LIMIT 1
\set ON_ERROR_STOP 0
DROP TABLE :COMPRESSED_CHUNK_NAME;
ERROR: dropping compressed chunks not supported
SELECT _timescaledb_functions.drop_chunk(:'COMPRESSED_CHUNK_NAME');
ERROR: dropping compressed chunks not supported
\set ON_ERROR_STOP 1
SELECT
chunk.schema_name|| '.' || chunk.table_name as "UNCOMPRESSED_CHUNK_NAME",
Expand Down
1 change: 1 addition & 0 deletions tsl/test/sql/compression_ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ WHERE uncomp_hyper.table_name like 'test1' ORDER BY chunk.id LIMIT 1

\set ON_ERROR_STOP 0
DROP TABLE :COMPRESSED_CHUNK_NAME;
SELECT _timescaledb_functions.drop_chunk(:'COMPRESSED_CHUNK_NAME');
\set ON_ERROR_STOP 1

SELECT
Expand Down

0 comments on commit a47ff5c

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/timescale/timescaledb/commit/a47ff5c72c495a331635c90e2712ac3c15372a32

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy