Repository navigation
fix: run only the missing schema changes on startup - #90
Merged
Merged
Conversation
danfimov
force-pushed
the
fix/schema-setup-privileges
branch
4 times, most recently
from
November 25, 2026 22:26
c4c1415 to
b537408
Compare
danfimov
force-pushed
the
fix/schema-setup-privileges
branch
3 times, most recently
from
November 25, 2026 22:39
5e1d916 to
a0f9dc2
Compare
ALTER TABLE and CREATE INDEX require owning the table even with IF NOT EXISTS, and CREATE TABLE IF NOT EXISTS requires the CREATE privilege on the schema. So startup failed for an application role that only has DML privileges, even when the table and indexes had been prepared in advance; for CREATE TABLE this was already the case before. Check which parts already exist (to_regclass, pg_attribute) under the schema lock and run DDL only for the missing ones.
danfimov
force-pushed
the
fix/schema-setup-privileges
branch
from
November 25, 2026 22:40
a0f9dc2 to
a562173
Compare
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.
ALTER TABLEandCREATE INDEXrequire owning the table even withIF NOT EXISTS.CREATE TABLE IF NOT EXISTSrequiresCREATEon the schema. So startup failed for an application role with only DML privileges, even when the table and indexes had been prepared in advance. ForCREATE TABLEthis was already the case onmain, althoughdocs/tutorial/common_issues.mdsuggests creating tables manually.Under the schema lock, startup now checks which parts exist (
to_regclass,pg_attribute) and runs DDL only for the missing ones.Test: an owner prepares the table and indexes, and a role with only
SELECT/INSERT/UPDATE/DELETEand sequenceUSAGEruns startup, kick and listen. The test fails without the fix for all four drivers.Part of a stack; review and merge bottom-up. Stress-harness numbers are from a local run: 4 drivers, ~250–550 kicks per scenario, 2 worker processes per driver.