Skip to content

test: add generated-column fixtures and fix AT_SetExpression/AT_DropExpression deparsing#299

Merged
pyramation merged 1 commit into
mainfrom
feat/generated-column-fixtures
Jul 11, 2026
Merged

test: add generated-column fixtures and fix AT_SetExpression/AT_DropExpression deparsing#299
pyramation merged 1 commit into
mainfrom
feat/generated-column-fixtures

Conversation

@pyramation

Copy link
Copy Markdown
Collaborator

Summary

Add comprehensive fixture coverage for generated columns and fix the AlterTableCmd deparsing for AT_SetExpression and AT_DropExpression.

What changed

  • Added __fixtures__/kitchen-sink/misc/generated-columns.sql with round-trip statements for:
    • CREATE TABLE ... GENERATED ALWAYS AS (expr) STORED (arithmetic, function calls, type modifiers, CASE, NOT NULL/UNIQUE)
    • ALTER TABLE ... ADD COLUMN ... GENERATED ALWAYS AS (expr) STORED
    • ALTER TABLE ... ALTER COLUMN ... SET EXPRESSION AS (expr)
    • ALTER TABLE ... ALTER COLUMN ... DROP EXPRESSION
    • ALTER TABLE ... ALTER COLUMN ... DROP EXPRESSION IF EXISTS
  • Regenerated __fixtures__/generated/generated.json and packages/deparser/__tests__/kitchen-sink/misc-generated-columns.test.ts.
  • Fixed packages/deparser/src/deparser.ts AlterTableCmd:
    • AT_SetExpression now emits SET EXPRESSION AS (expr) so it round-trips.
    • AT_DropExpression now emits DROP EXPRESSION IF EXISTS when missing_ok is true.

Tests

  • npx jest __tests__/kitchen-sink/misc-generated-columns.test.ts passes.
  • Full npx jest in packages/deparser passes: 292 suites, 712 tests, 424 snapshots.

Link to Devin session: https://app.devin.ai/sessions/71d24cab0da24e7b83d3f5a6e9fef9a2
Requested by: @pyramation

…xpression deparsing

- Add __fixtures__/kitchen-sink/misc/generated-columns.sql covering CREATE, ADD, SET, DROP, and DROP IF EXISTS for generated columns

- Fix AT_SetExpression to emit SET EXPRESSION AS (expr)

- Fix AT_DropExpression to emit DROP EXPRESSION IF EXISTS when missing_ok is true

- Regenerate generated.json and kitchen-sink test file
@pyramation pyramation self-assigned this Jul 11, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@pyramation pyramation merged commit 023cea2 into main Jul 11, 2026
16 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.

1 participant