Repository navigation
Ship transaction-free bundles by default - #6
Merged
lemuelroberto merged 2 commits intoSep 30, 2026
Merged
Conversation
Every sql/ script opened and committed its own transactions, so a release bundle carried dozens of top-level BEGIN;/COMMIT; pairs. That made the bundle impossible to embed where someone else already owns the transaction: a migration tool runs each migration inside one, and the bundle's first COMMIT; ended it halfway through, leaving the rest to run in autocommit. pg_tle hit the same wall, which is why pgtle-wrap.sh stripped those lines with grep before wrapping. The sources now carry no transaction control, and the plain artifacts are what the sources say. The caller picks the boundary: psql -1, a migration's transaction, or CREATE EXTENSION. For a bare psql -f that should still be all or nothing, every artifact gets a -tx twin holding exactly one BEGIN; and one COMMIT; around the whole bundle, rather than one pair per script section. Nothing in the scripts depended on a commit between sections: the all-in bundle installs inside a single transaction and a rollback leaves no cel schema behind. The release smoke job now proves exactly that for each plain artifact, and build-release.sh, which CI runs, refuses a BEGIN; or COMMIT; line that finds its way back into sql/.
The artifact set changed shape: plain files lost their transaction control and -tx twins were added. A consumer pinning 0.0.1 must not receive files that behave differently under the same name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Release bundles carried one
BEGIN;/COMMIT;pair per script section(30 pairs in the all-in bundle). That makes them impossible to embed
where the caller already owns the transaction — a migration tool
(Kysely, Flyway, Liquibase…) runs each migration inside one, and the
bundle's first
COMMIT;ended it halfway through.pgtle-wrap.shalready worked around the same problem for
CREATE EXTENSIONbygrepping the lines out.
What changes
sql/carries no transaction control. The plain artifacts are whatthe sources say and run inside the caller's transaction (
psql -1,a migration,
CREATE EXTENSION).-txtwin with exactly oneBEGIN;andone
COMMIT;around the whole bundle, for a barepsql -f.pgtle-wrap.shwraps the plain files unchanged and refuses inputthat controls transactions (e.g. a
-txfile).build-release.shrefuses aBEGIN;/COMMIT;line insql/; CI nowruns it on every PR.
BEGINand
ROLLBACKand asserts nocelschema survives (a strayCOMMIT;fails it), then installs it with--single-transaction,then installs the
-txtwin with a barepsql -f.docs/INSTALL.mddocuments both shapes and a "Inside a migrationtool" section. Version bumped to 0.0.2.
Verified locally
docker compose up -d --wait+go vet ./...+go test ./...: ok.release.yml: ok forcel4postgresandcel4postgres-core, both shapes. With aCOMMIT;injected at top level of the plain bundle it fails with
"committed on its own".
allandcore ext_strings: ok.Release
After merge, the 0.0.2 release is the manual
Releaseworkflow.fga4postgres will vendor the published
cel4postgres--0.0.2.sql.