Skip to content

Skip creating ps_crud entries when clearing raw tables#169

Merged
simolus3 merged 1 commit intomainfrom
no-crud-on-raw-table-clar
Mar 18, 2026
Merged

Skip creating ps_crud entries when clearing raw tables#169
simolus3 merged 1 commit intomainfrom
no-crud-on-raw-table-clar

Conversation

@simolus3
Copy link
Contributor

Deletes happening as part of powersync_clear() should not count as ps_crud entries. For JSON-based tables, we're able to do this by deleting from the underlying table instead of the view.

For raw tables, we'd run the clear statement configured on the table. This is problematic since raw tables would typically have triggers recording the delete in ps_crud, and we have no separate data table to side-step that trigger.

As a cheap workaround, this makes powersync_in_sync_operation() true while clearing raw tables. That disarms the ps_crud vtab, giving us the behavior we want.

Originally reported on the Kotlin SDK: powersync-ja/powersync-kotlin#335

@simolus3 simolus3 requested a review from rkistner March 18, 2026 10:36
@simolus3 simolus3 merged commit 9dfadee into main Mar 18, 2026
25 checks passed
@simolus3 simolus3 deleted the no-crud-on-raw-table-clar branch March 18, 2026 11:52
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.

2 participants