Error: Cannot Insert a NULL Value Into Column _row
Issue
Syncs fail with the following error:
Cannot insert a NULL value into column _row.
Environment
- Connector: Google Sheets
- Destination: Redshift
Resolution
To resolve this issue, choose one of the following options:
- Grant the Fivetran user
ALTERpermissions on the schema so Fivetran can restore the primary key:GRANT USAGE ON SCHEMA <schema_name> TO <fivetran_user>; GRANT ALTER ON ALL TABLES IN SCHEMA <schema_name> TO <fivetran_user>; - Temporarily allow
_rowto be nullable so that the merge can proceed:ALTER TABLE <schema_name>.<table_name> ALTER COLUMN _row DROP NOT NULL; - If the primary key is still missing, add it manually:
ALTER TABLE <schema_name>.<table_name> ADD PRIMARY KEY (_row);
After the schema is consistent, the sync should succeed.
Cause
This issue occurs when a previous schema update changes the _row primary key column to NOT NULL, but we can't restore the primary key because the Fivetran user doesn't have the required ALTER permissions on the schema. When this happens, the table is left in a partial state:
_rowisNOT NULL- The primary key is missing