Skip to content

Commit 83da4be

Browse files
EDsCODEclaude
andcommitted
Add logging for transpiled queries when they differ from original
Shows what query is actually executed after transpilation, helping debug PostgreSQL to DuckDB conversion issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent fe9d446 commit 83da4be

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

server/conn.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,14 @@ func (c *clientConn) handleQuery(body []byte) error {
323323
}
324324

325325
// Use the transpiled SQL
326+
originalQuery := query
326327
query = result.SQL
327328

329+
// Log the transpiled query if it differs from the original
330+
if query != originalQuery {
331+
log.Printf("[%s] Executed: %s", c.username, query)
332+
}
333+
328334
// Determine command type for proper response
329335
upperQuery := strings.ToUpper(query)
330336
cmdType := c.getCommandType(upperQuery)
@@ -1085,6 +1091,9 @@ func (c *clientConn) handleParse(body []byte) {
10851091
}
10861092

10871093
log.Printf("[%s] Prepared statement %q: %s", c.username, stmtName, query)
1094+
if result.SQL != query {
1095+
log.Printf("[%s] Prepared statement %q transpiled: %s", c.username, stmtName, result.SQL)
1096+
}
10881097
writeParseComplete(c.writer)
10891098
}
10901099

0 commit comments

Comments
 (0)