# AZ803: The sync role is the app role

The sync role reads every row: it bypasses row-level security, as the engine must to read the tables by logical replication. The app role is the one the rules apply to, so the two must be different roles, and the sync role can't be PUBLIC either. Applying also refuses a sync role that is a member of the app role or has it as a member (AZ808).

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 role app_user
sync app.files : view
```

```
line 6: the sync role reads every row (it holds BYPASSRLS), so it can't be the app role: give the engine a role of its own [AZ803]
```

## 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
```
