-
Notifications
You must be signed in to change notification settings - Fork 1
feat: support generated column #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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
GeneratedColumnandGeneratedColumnKindtypes to represent generated column specifications - Added
generated_as_storedandgenerated_as_virtualmethods toColumnDeffor creating generated columns - Added SQL generation logic for
GENERATED ALWAYS ASsyntax - 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.
|
@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. |
No description provided.