Skip to content

Conversation

@leiysky
Copy link
Contributor

@leiysky leiysky commented Jan 31, 2026

No description provided.

Copy link

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 generated columns to the PostgreSQL query builder. However, there are several critical issues with the implementation that prevent it from working correctly with PostgreSQL.

Changes:

  • Added GeneratedColumn and GeneratedColumnKind types to represent generated column specifications
  • Added generated_as_stored and generated_as_virtual methods to ColumnDef for creating generated columns
  • Added SQL generation logic for GENERATED ALWAYS AS syntax
  • Added test coverage for generated columns in CREATE TABLE statements

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
pqb/src/table/column.rs Implements generated column support with new structs, enums, and builder methods for ColumnDef
pqb/tests/create_table.rs Adds test case demonstrating generated column usage in CREATE TABLE statements

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

@leiysky
Copy link
Contributor Author

leiysky commented Jan 31, 2026

@tisonkun We cannot easily ensure type-safety of generated column with default values specified, should we accpet the query anyway and let postgres crash?

@tisonkun
Copy link
Collaborator

tisonkun commented Jan 31, 2026

@tisonkun We cannot easily ensure type-safety of generated column with default values specified, should we accpet the query anyway and let postgres crash?

Yes. We can go with this first. SQL builder is basically string concatenation.

Each Value variant can have an associated column type, you can open an issue and let me investigate how to model an API to statically ensure this type association.

@leiysky leiysky merged commit 6ed2278 into fast:main Jan 31, 2026
9 checks passed
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.

2 participants