Records Available in Source Missing From Destination
Issue
Records available in the source PostgreSQL database are missing from the destination after a sync. No errors appear in Fivetran, but one or more destination tables contain fewer records than the corresponding source tables.
Environment
- Connector: PostgreSQL
- Source: PostgreSQL or Supabase
- Incremental sync method: Logical Replication
Resolution
To resolve this issue, connect to the source database as a superuser and use one of the following options.
Option 1 (Recommended): Allow the Fivetran role to bypass RLS
Run the following command to allow the Fivetran role to read all tables with row-level security (RLS) enabled, including tables where you enable RLS in the future:
ALTER ROLE fivetran BYPASSRLS;
Option 2: Grant access to each affected table
Run the following command to create a permissive read policy for the Fivetran role on an affected table:
CREATE POLICY fivetran_read_<table_name>
ON public.<table_name>
FOR SELECT
TO fivetran
USING (true);
Repeat for each affected table.
You must create a separate policy for each new table with RLS enabled.
After applying either option, trigger a table-level re-sync.
Cause
This issue occurs when you enable RLS on a source table and no applicable read policy exists for the Fivetran role. When this happens, PostgreSQL applies a default-deny policy and returns no rows without raising an error. As a result, we can detect the table but can't sync its records.