Skip to content

feat: support expression index#17

Merged
leiysky merged 2 commits intofast:mainfrom
leiysky:feat/index-expr
Feb 2, 2026
Merged

feat: support expression index#17
leiysky merged 2 commits intofast:mainfrom
leiysky:feat/index-expr

Conversation

@leiysky
Copy link
Contributor

@leiysky leiysky commented Feb 2, 2026

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds support for expression indexes to the PostgreSQL query builder. Expression indexes allow creating indexes on computed expressions (like lower(email)) rather than just simple columns. The implementation changes the internal representation of index columns from Vec<Iden> to Vec<Expr> and adds a new expr() method to the CreateIndex builder.

Changes:

  • Modified the CreateIndex struct to use Vec<Expr> instead of Vec<Iden> for columns, enabling support for both simple column references and complex expressions
  • Added new expr() method for adding expression-based index entries
  • Updated write_index_columns() to use write_tuple() for rendering, and made write_tuple() publicly accessible within the crate

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
pqb/src/index/create.rs Modified column type from Vec to Vec, added expr() method, updated write_index_columns to use write_tuple
pqb/src/expr.rs Changed write_tuple visibility from private to pub(crate) to enable use in index module
pqb/tests/index.rs Updated all existing test expectations to reflect new SQL output format and added two new tests for expression indexes
pqb/tests/create_table.rs Updated PRIMARY KEY test expectation to match new rendering behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@leiysky leiysky merged commit bfe8d79 into fast:main Feb 2, 2026
15 checks passed
@leiysky leiysky deleted the feat/index-expr branch February 2, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments