Skip to content

Postgres: Accept generated columns with no mode keyword or VIRTUAL - #2441

Open
ting-hong-shieh wants to merge 5 commits into
apache:mainfrom
ting-hong-shieh:postgres-generated-column-mode
Open

ting-hong-shieh wants to merge 5 commits into
apache:mainfrom
ting-hong-shieh:postgres-generated-column-mode

Conversation

@ting-hong-shieh

@ting-hong-shieh ting-hong-shieh commented Aug 16, 2026 •

Copy link
Copy Markdown

Fixes #2407.

PostgreSqlDialect rejected GENERATED ALWAYS AS (expr) without STORED, including the omitted-mode and VIRTUAL forms supported by PostgreSQL 18. Use the existing shared parser handling instead of the PostgreSQL-only restriction.

Tests cover omitted mode, VIRTUAL, STORED, and a following NOT NULL constraint. The regression has a committed fuzz seed.

Validation for the contents committed as 5eb45ade97d2bf4fca4a0348c57802f701349b83: cargo test --all-features (1,852 passed, 7 ignored), cargo clippy --all-targets --all-features -- -D warnings, formatting, and independent adversarial review. Fuzzing was not rerun for this refresh. Hosted CI may require maintainer approval.

AI assistance was used for implementation, conflict resolution, and validation.

@LucaCappelletti94 LucaCappelletti94 added PostgreSQL needs rebasing The PR has collisions with main and requires rebasing labels Sep 22, 2026
PostgreSqlDialect required STORED after GENERATED ALWAYS AS (expr), so it
rejected both the omitted mode and an explicit VIRTUAL.

PostgreSQL 18 documents the grammar as
GENERATED ALWAYS AS ( generation_expr ) [ STORED | VIRTUAL ], with VIRTUAL as
the default when the keyword is omitted.

Remove the PostgreSqlDialect special case so the dialect falls back to the
shared handling, which parses both forms and round-trips them unchanged.
@LucaCappelletti94
LucaCappelletti94 force-pushed the postgres-generated-column-mode branch from 920f85c to 3f25d96 Compare September 24, 2026 22:09
@LucaCappelletti94 LucaCappelletti94 removed the needs rebasing The PR has collisions with main and requires rebasing label Sep 24, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.02%. Comparing base (88ffee6) to head (3f25d96).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2441   +/-   ##
=======================================
  Coverage   81.02%   81.02%           
=======================================
  Files          42       42           
  Lines       33436    33433    -3     
  Branches    33436    33433    -3     
=======================================
- Hits        27090    27089    -1     
+ Misses       2789     2787    -2     
  Partials     3557     3557           

☔ 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.

@ting-hong-shieh
ting-hong-shieh marked this pull request as ready for review October 20, 2026 22:41
@ting-hong-shieh

ting-hong-shieh commented Oct 28, 2026 •

Copy link
Copy Markdown
Author

Updated against main e15e9abf in dbd0dcb. The PostgreSQL test conflict is resolved, retaining every upstream test and the generated-column regression, including the UNIQUE-constraint tests that landed during this refresh.

Validation: cargo test --all-features passed (1,842 tests, 7 ignored), Clippy with warnings denied passed, and formatting passed. The regression fuzz seed is retained; fuzzing was not rerun for this refresh.

Signed-off-by: Ting-Hong Shieh <32212900+ting-hong-shieh@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PostgreSQL 18 generated virtual columns require STORED

3 participants