-
Notifications
You must be signed in to change notification settings - Fork 684
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
PG17 Add Regression Test for ALTER TABLE ... SET ACCESS METHOD DEFAULT #7803
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release-13.0 #7803 +/- ##
===============================================
Coverage ? 89.64%
===============================================
Files ? 274
Lines ? 59726
Branches ? 7452
===============================================
Hits ? 53540
Misses ? 4056
Partials ? 2130 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a problem here because default access method may be different in the cluster nodes. Steps to reproduce below:
CREATE ACCESS METHOD heap2 TYPE TABLE HANDLER heap_tableam_handler;
CREATE TABLE dist_table (id SERIAL PRIMARY KEY, data TEXT) USING heap;
SELECT create_distributed_table('dist_table', 'id');
SET default_table_access_method = 'heap2';
-- default in coordinator is heap2, default in workers is heap
ALTER TABLE dist_table SET ACCESS METHOD DEFAULT;
SELECT c.relname, am.amname FROM pg_class c, pg_am am
WHERE c.relam = am.oid and c.relname IN ('dist_table', 'ref_table');
relname | amname
------------+--------
dist_table | heap2
(1 row)
\c - - - :worker_1_port
SELECT c.relname, am.amname FROM pg_class c, pg_am am
WHERE c.relam = am.oid and c.relname IN ('dist_table', 'ref_table');
relname | amname
------------+--------
dist_table | heap
(1 row)
The problem is that the alter table command is distributed as it is. One way to fix this is to propagate the alter table command by replacing "default" with the actual access method name. This requires code changes
d5d31d3
to
15a9e49
Compare
10759d0
to
8ecfc56
Compare
15a9e49
to
b9c5f85
Compare
91e681a
to
41cc5c1
Compare
b9c5f85
to
44ddec6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
Rebase to release-13.0
and merge after all tests have passed (except packaging images tests)
d26091d
to
efacf92
Compare
update update Update src/test/regress/sql/pg17.sql Co-authored-by: Naisila Puka <37271756+naisila@users.noreply.github.com> Update src/backend/distributed/commands/table.c Co-authored-by: Naisila Puka <37271756+naisila@users.noreply.github.com> update remove citus tools update update indent
efacf92
to
2f3262c
Compare
This PR introduces and enforces an error check preventing ALTER TABLE ... SET ACCESS METHOD DEFAULT on both Citus local tables (added via citus_add_local_table_to_metadata) and distributed/partitioned distributed tables. The regression tests now demonstrate that each table type raises an error advising users to explicitly specify an access method, rather than relying on DEFAULT. This ensures consistent behavior across local and distributed environments in Citus.
postgres/postgres@d61a6cad6