Skip to content

fix(db): Allow tables with triggers - #42

Merged
moshloop merged 1 commit into
mainfrom
fix/postgres-trigger-dependents
Nov 26, 2026
Merged

moshloop merged 1 commit into
mainfrom
fix/postgres-trigger-dependents

Conversation

@moshloop

Copy link
Copy Markdown
Member

What

  • Allow planning for tables that have triggers or deferrable, exclusion, or unvalidated constraints.
  • Refuse only changes PostgreSQL itself rejects: retyping or dropping a column read by a trigger's UPDATE OF list or WHEN clause, reported with the trigger definition.
  • Refuse only a change to a deferrable, exclusion, or unvalidated constraint rather than its whole table.

Why

  • Triggers are usually created by a bundle's post scripts, so the previous blanket refusal blocked plans.
  • The planner now orders a foreign key's referenced table ahead of it when a cycle elsewhere splits foreign keys out.

Triggers are usually created by a bundle's post scripts, so a table carrying one was refused and blocked plans. Refuse only the changes PostgreSQL itself rejects: a retype or drop of a column a trigger's UPDATE OF list or WHEN clause reads, reported with the trigger definition. Likewise refuse only a change to a deferrable, exclusion, or unvalidated constraint rather than its whole table. The planner also orders a foreign key's referenced table ahead of it when a cycle elsewhere splits foreign keys out.

Claude-Session-Id: 2870a551-cf0b-4b70-8699-6635bcd8c31c
@moshloop
moshloop enabled auto-merge (rebase) November 26, 2026 12:23
@moshloop
moshloop merged commit 1ff9e9c into main Nov 26, 2026
11 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.6.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions

Copy link
Copy Markdown

Gavel summary

Source Pass Fail Skip Duration
postgres 45 0 0 3.5s

Totals: 45 passed · 0 failed · 0 skipped · 3.5s

View full results

@github-actions

Copy link
Copy Markdown

Gavel summary

Source Pass Fail Skip Duration
integration 34 0 0 1m46s

Totals: 34 passed · 0 failed · 0 skipped · 1m46s

View full results

@github-actions

Copy link
Copy Markdown

Gavel summary

Source Pass Fail Skip Duration
access 35 0 0 9ms
atlasdriver 11 0 0 8ms
capabilities 36 0 0 5ms
changeset 5 0 0 1ms
compare 19 0 0 2.0s
connections 10 0 0 8ms
csvdata 5 0 0 964.477µs
database 3 0 0 950ms
dialect 16 0 0 5ms
engine 135 0 0 47ms
github.com/flanksource/sqlglot-go/database/atlas/internal/specutil 5 0 0 -
github.com/flanksource/sqlglot-go/database/atlas/internal/sqlx 61 0 0 -
github.com/flanksource/sqlglot-go/database/inspect 3 0 0 -
github.com/flanksource/sqlglot-go/database/migrate 20 0 0 -
github.com/flanksource/sqlglot-go/harness 14 0 1 5.8s
github.com/flanksource/sqlglot-go/sqlglot 3025 0 0 670ms
harness 7 0 0 329.798µs
history 15 0 0 85ms
inspect 1 0 0 113.019µs
migrate 119 0 7 976ms
postgres 21 0 0 22ms
proxy 3 0 0 11ms
scripts 92 0 0 23ms
snapshot 19 0 0 4ms
sqlglot 197 0 0 2.7s
sqlite 61 0 0 1.7s
sqlserver 518 0 0 190ms
target 33 0 0 14ms
tds 60 0 0 174ms
workflow 84 0 0 235ms

Totals: 4633 passed · 0 failed · 8 skipped · 15.7s

View full results

@github-actions

Copy link
Copy Markdown

Gavel summary

Source Pass Fail Skip Duration
lint: golangci-lint 1 0 0 2m21s

Totals: 1 passed · 0 failed · 0 skipped · 2m21s

View full results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant