From d62abe8bae983bc0527352a9c0ffbdcb8e9de62b Mon Sep 17 00:00:00 2001 From: Chris Bandy Date: Wed, 24 Jun 2026 01:01:52 +0000 Subject: [PATCH] Call TraceQueryEnd during Exec errors We should make every effort to call `TraceQueryEnd` after calling `TraceQueryStart`. --- conn.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conn.go b/conn.go index bc5d06493..547dc4f85 100644 --- a/conn.go +++ b/conn.go @@ -475,6 +475,9 @@ func (c *Conn) Exec(ctx context.Context, sql string, arguments ...any) (pgconn.C } if err := c.deallocateInvalidatedCachedStatements(ctx); err != nil { + if c.queryTracer != nil { + c.queryTracer.TraceQueryEnd(ctx, c, TraceQueryEndData{Err: err}) + } return pgconn.CommandTag{}, err }