From c072c8b8f384ead90b02d1d64648a8e4ff41a0a3 Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Thu, 16 May 2024 10:10:29 -0400 Subject: [PATCH] better error for normalize failure in postgres --- flow/connectors/postgres/postgres.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/flow/connectors/postgres/postgres.go b/flow/connectors/postgres/postgres.go index 3642289756..507e2932ec 100644 --- a/flow/connectors/postgres/postgres.go +++ b/flow/connectors/postgres/postgres.go @@ -653,7 +653,14 @@ func (c *PostgresConnector) NormalizeRecords( for _, normalizeStatement := range normalizeStatements { ct, err := normalizeRecordsTx.Exec(ctx, normalizeStatement, normBatchID, req.SyncBatchID, destinationTableName) if err != nil { - return nil, fmt.Errorf("error executing normalize statement: %w", err) + c.logger.Error("error executing normalize statement", + slog.String("statement", normalizeStatement), + slog.Int64("normBatchID", normBatchID), + slog.Int64("syncBatchID", req.SyncBatchID), + slog.String("destinationTableName", destinationTableName), + slog.Any("error", err), + ) + return nil, fmt.Errorf("error executing normalize statement for table %s: %w", destinationTableName, err) } totalRowsAffected += int(ct.RowsAffected()) }