Skip to content

AZ802: Sync lines and no sync role, or a sync role and nothing synced ​

The sync index is read by the sync engine's Postgres role, which sync role names: sync lines need it, and it (and sync after commit) needs at least one sync line. The role reads every row (it holds BYPASSRLS), so it is the engine's own: CREATE ROLE sync_engine LOGIN REPLICATION BYPASSRLS.

Reported when the policy is compiled: rowstile check, the editor, rowstile dev.

The mistake ​

authz
app role app_user
type user = app.users
type file = app.files
  owner : user = owner_id
  can view = owner
sync app.files : view
line 6: sync lines need the sync engine's Postgres role, which reads the index: sync role sync_engine [AZ802]

Fixed ​

authz
app role app_user
type user = app.users
type file = app.files
  owner : user = owner_id
  can view = owner
sync role sync_engine
sync app.files : view