Repository navigation
fix(sql): preserve index operator classes when cloning - #6737
Open
cangen185-sudo wants to merge 1 commit into
Open
cangen185-sudo wants to merge 1 commit into
cangen185-sudo wants to merge 1 commit into
Conversation
cangen185-sudo
marked this pull request as ready for review
October 15, 2026 01:27
cangen185-sudo
marked this pull request as draft
October 15, 2026 01:28
cangen185-sudo
marked this pull request as ready for review
October 15, 2026 01:42
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.
Description
Cloning a parsed PostgreSQL
CREATE INDEXstatement drops the indexed column's operator class. The parser and SQL output visitor supportopclass, butSQLSelectOrderByItem.clone()does not copy it;SQLIndexDefinition.cloneTo()andSQLCreateIndexStatement.clone()use that method.Deep-clone
opclassthrough its setter, and attach the expression's parent insetOpclass()consistently withsetExpr(). Collation, direction and NULL ordering continue to be copied as before.Reproduction and validation
The added regression parses an index column containing
"pg_catalog"."text_ops",COLLATE,ASCandNULLS LAST, then compares the original and cloned SQL. Before the fix, the cloned SQL omits"pg_catalog"."text_ops". Two further regressions check the parsed/set operator class's parent and the null/clear path.fcc35ec7207f46d50b7578d5598108502168747fFocused verification command (5 tests passed):
testlifecycle compiled the core production/test sources; repository Checkstyle reported 0 violations.git diff --check: passed.The expanded recheck followed a clean compilation. A broad name-based probe also selected legacy tests outside the configured BVT suite:
PGUpsertTestdiffers only by a trailing semicolon, andPGAlterTestreports an existing OWNER TO parser gap. Both reproduce unchanged on a clean upstream checkout. They are not included in the 82 passing BVT results; no whole-repository pass is claimed.Searches for
opclass,SQLSelectOrderByItemand clone/index PRs found no equivalent contribution. This is a new locally reproduced defect; it does not claim to fix #6731, whose lexer boundary is already corrected on current master.The contributor has signed the CLA; the live
license/clacheck passed. GitHub Actions still requires maintainer approval.Codex assisted with audit, reproduction, implementation and validation; a bounded read-only review checked the AST call path. Ready for maintainer review.