Skip to content

PostgreSQL: Display the index operator class before the sort options - #2663

Open
LucaCappelletti94 wants to merge 1 commit into
mainfrom
index-column-opclass-order
Open

LucaCappelletti94 wants to merge 1 commit into
mainfrom
index-column-opclass-order

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

CREATE INDEX ii ON t(c ops DESC) was displayed as CREATE INDEX ii ON t(c DESC ops), putting the operator class after the sort options, which no longer parses as the same index column. PostgreSQL's CREATE INDEX synopsis puts the operator class first, followed by ASC/DESC and NULLS (https://www.postgresql.org/docs/current/sql-createindex.html).

The sort modifiers of OrderByExpr (ASC/DESC, NULLS, WITH FILL) are now written by a shared helper, and IndexColumn prints the column expression, then the operator class, then those modifiers. The parser reads operator classes in every dialect, so the test round-trips CREATE INDEX columns with and without an operator class and sort options in all of them, and checks the parsed operator class and sort order.

@LucaCappelletti94 LucaCappelletti94 added bug Something isn't working PostgreSQL labels Oct 17, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.25%. Comparing base (1aabd12) to head (7a1eeb7).

Files with missing lines Patch % Lines
src/ast/ddl.rs 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2663   +/-   ##
=======================================
  Coverage   81.25%   81.25%           
=======================================
  Files          42       42           
  Lines       33910    33913    +3     
  Branches    33910    33913    +3     
=======================================
+ Hits        27553    27556    +3     
  Misses       2792     2792           
  Partials     3565     3565           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working PostgreSQL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants