Fix invalid SQL from index TABLESPACE clause on partitioned tables - #10342
Open
dpage wants to merge 1 commit into
Open
Fix invalid SQL from index TABLESPACE clause on partitioned tables#10342dpage wants to merge 1 commit into
dpage wants to merge 1 commit into
Conversation
PostgreSQL rejects an explicit TABLESPACE clause naming the database's
own default tablespace when the index is on a partitioned table
('cannot specify default tablespace for partitioned relations'), so
the SQL pgAdmin generated for a new index could not be executed
against a partitioned table whenever no non-default tablespace was
chosen. The index_constraint and exclusion_constraint create.sql
templates already guard against emitting this redundant clause;
extend the same guard to the plain index create.sql templates.
Closes pgadmin-org#10341
|
Warning Review limit reachedNext included review available in 52 minutes. View limit detailsLimit details: You’ve used all 8 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (35)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TABLESPACEclause naming the database's own default tablespace when the index belongs to a partitioned table (cannot specify default tablespace for partitioned relations), so the SQL pgAdmin generated for a new index on a partitioned table could not be executed whenever the Tablespace field was left at its default (pg_default).index_constraintandexclusion_constraintcreate.sql templates already guard against emitting this redundant clause (data.spcname != "pg_default"); this extends the same guard to the plain indexcreate.sqltemplates (defaultand15_plusbuckets).indexes/tests/{default,15_plus}to match the corrected output.Test plan
test_create_sql_partitioned_tablespace.py, a DB-free unit test rendering the templates directly and asserting the redundant clause is omitted while an explicit non-default tablespace is still emitted.regression/runtests.py --pkg browser.server_groups.servers.databases.schemas.tables.indexes.tests— 49/49 passing.regression/runtests.py --pkg browser.server_groups.servers.databases.schemas.tables.tests— 113/113 passing (no regression in the parent Tables SQL, which embeds indexes).CREATE INDEX ... TABLESPACE pg_defaulton a partitioned table errors, while a real non-default tablespace works fine.Closes #10341