Repository navigation
fix(blocks): load block columns without DDL for roles that can't create tables (1.2.2) - #99
Merged
Merged
Conversation
…te tables Loading a block column (every new session's context load) ran CREATE TABLE IF NOT EXISTS on the blocks table. PostgreSQL checks the CREATE privilege and SQLite Cloud's authorizer rejects the statement even when the table exists, so for a sync role the setup failed silently and every block write in that session failed. - create the blocks table only when it is missing - update the table context only once every block statement is prepared, so a failed setup can be retried in the same session - keep the setup error and report it with the block write that fails Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…reate it on load - check the blocks table with to_regclass on PostgreSQL, so names cut to 63 bytes and unqualified names resolved through search_path match the block statements - only cloudsync_set_column creates the blocks table; loading a session runs no DDL and reports a missing table instead - every setup failure sets its own error, and one helper reports the saved cause without repeating the database error - tests: deny every schema change in the SQLite test, a 49-character table name in the PostgreSQL test Co-Authored-By: Claude Opus 5.5 <[email protected]>
…c_cleanup cloudsync_cleanup dropped the blocks table only when the session had prepared its statements, so a table this session failed to set up stayed behind and a later cloudsync_set_column reused its old rows. Look it up instead. Test 76 now checks the long-name table's block changes and their values instead of counting block changes across all tables. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Loading a block column at the start of every session ran
CREATE TABLE IF NOT EXISTSon the blocks table. PostgreSQL checks the CREATE privilege, and SQLite Cloud's authorizer rejects the statement, even when the table exists. A role that only syncs therefore failed every block write in that session.cloudsync_set_columncreates the blocks table, and a block write reports a missing one.to_regclass, the way its statements resolve it (names cut to 63 bytes,search_path).Tests: a SQLite unit test with an authorizer that denies every schema change, and
test/postgresql/76_block_columns_sync_role.sql(new session as a role without CREATE, including a 49-character table name).make unittestgives 162 OK; the PostgreSQL suite gives 626 PASS, 0 failures.🤖 Generated with Claude Code