diff --git a/flow/connectors/postgres/qrep.go b/flow/connectors/postgres/qrep.go index 3d54c9a6dc..7683111708 100644 --- a/flow/connectors/postgres/qrep.go +++ b/flow/connectors/postgres/qrep.go @@ -481,7 +481,8 @@ func (c *PostgresConnector) SetupQRepMetadataTables(config *protos.QRepConfig) e "flowName": config.FlowJobName, }).Infof("Setup metadata table.") - if config.WriteMode.WriteType == protos.QRepWriteType_QREP_WRITE_MODE_OVERWRITE { + if config.WriteMode != nil && + config.WriteMode.WriteType == protos.QRepWriteType_QREP_WRITE_MODE_OVERWRITE { _, err = c.pool.Exec(c.ctx, fmt.Sprintf("TRUNCATE TABLE %s", config.DestinationTableIdentifier)) if err != nil { return fmt.Errorf("failed to TRUNCATE table before query replication: %w", err)