Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RENAME TO/SET SCHEMA on distributed hypertable #4121

Merged
merged 1 commit into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions tsl/src/remote/dist_ddl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1223,9 +1223,6 @@ dist_ddl_end(EventTriggerData *command)
{
HypertableType type = dist_ddl_state_get_hypertable_type();

if (type == HYPERTABLE_DISTRIBUTED)
dist_ddl_error_raise_unsupported();

/* Ensure this operation is executed by the access node session. */
if (type == HYPERTABLE_DISTRIBUTED_MEMBER)
dist_ddl_error_if_not_allowed_data_node_session();
Expand Down
16 changes: 10 additions & 6 deletions tsl/test/expected/dist_ddl.out
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,16 @@ NOTICE: adding not-null constraint to column "time"
TRUNCATE non_disttable1, non_disttable2;
-- Truncating one distributed hypertable should be OK
TRUNCATE disttable;
-- RENAME TO
ALTER TABLE disttable RENAME TO disttable2;
ALTER TABLE disttable2 RENAME TO disttable;
-- SET SCHEMA
ALTER TABLE disttable SET SCHEMA some_schema;
ALTER TABLE some_schema.disttable SET SCHEMA public;
\set ON_ERROR_STOP 0
ALTER TABLE disttable SET SCHEMA some_unexist_schema;
ERROR: schema "some_unexist_schema" does not exist
\set ON_ERROR_STOP 1
-- Test unsupported operations on distributed hypertable
\set ON_ERROR_STOP 0
-- test set_replication_factor on non-hypertable
Expand All @@ -472,12 +482,6 @@ TRUNCATE disttable, non_disttable2;
ERROR: operation not supported on distributed hypertable
CLUSTER disttable USING disttable_description_idx;
ERROR: operation not supported on distributed hypertable
ALTER TABLE disttable RENAME TO disttable2;
ERROR: operation not supported on distributed hypertable
ALTER TABLE disttable SET SCHEMA some_unexist_schema;
ERROR: schema "some_unexist_schema" does not exist
ALTER TABLE disttable SET SCHEMA some_schema;
ERROR: operation not supported on distributed hypertable
DROP TABLE non_disttable1, disttable;
ERROR: cannot drop a hypertable along with other objects
DROP TABLE disttable, non_disttable2;
Expand Down
15 changes: 11 additions & 4 deletions tsl/test/sql/dist_ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,17 @@ TRUNCATE non_disttable1, non_disttable2;
-- Truncating one distributed hypertable should be OK
TRUNCATE disttable;

-- RENAME TO
ALTER TABLE disttable RENAME TO disttable2;
ALTER TABLE disttable2 RENAME TO disttable;

-- SET SCHEMA
ALTER TABLE disttable SET SCHEMA some_schema;
ALTER TABLE some_schema.disttable SET SCHEMA public;
\set ON_ERROR_STOP 0
ALTER TABLE disttable SET SCHEMA some_unexist_schema;
\set ON_ERROR_STOP 1

-- Test unsupported operations on distributed hypertable
\set ON_ERROR_STOP 0

Expand All @@ -118,10 +129,6 @@ TRUNCATE disttable, non_disttable2;

CLUSTER disttable USING disttable_description_idx;

ALTER TABLE disttable RENAME TO disttable2;
ALTER TABLE disttable SET SCHEMA some_unexist_schema;
ALTER TABLE disttable SET SCHEMA some_schema;

DROP TABLE non_disttable1, disttable;
DROP TABLE disttable, non_disttable2;
DROP TABLE disttable, disttable;
Expand Down