From b87adaa8e0627b759f4902c37a7a80c10a6e3932 Mon Sep 17 00:00:00 2001 From: Nassib Nassar Date: Tue, 8 Oct 2024 19:04:34 -0400 Subject: [PATCH] Write more compact log detail for matcher --- cmd/metadb/server/exec.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cmd/metadb/server/exec.go b/cmd/metadb/server/exec.go index 79c37fd2..7443f550 100644 --- a/cmd/metadb/server/exec.go +++ b/cmd/metadb/server/exec.go @@ -485,7 +485,21 @@ func isCurrentIdenticalMatch(ctx context.Context, cmd *command.Command, tx *pgxp b.WriteString(" LIMIT 1") rows, err := tx.Query(ctx, b.String()) if err != nil { - log.Detail("%s", b.String()) + var d strings.Builder + fmt.Fprintf(&d, "matching: %s.%s:", table.Schema, table.Table) + fmt.Fprintf(&d, " __origin='%s'", cmd.Origin) + for i := range columns { + if columns[i].Unavailable { + continue + } + fmt.Fprintf(&d, " %s=", columns[i].Name) + if columns[i].Data == nil { + d.WriteString("null") + } else { + encodeSQLData(&d, columns[i].SQLData, columns[i].DType) + } + } + log.Detail("%s", d.String()) return false, 0, fmt.Errorf("querying for matching current row: %w", err) } defer rows.Close()