Skip to content

feat: add --log-queries flag for debugging client queries#327

Open
fuziontech wants to merge 2 commits intomainfrom
feat/log-queries
Open

feat: add --log-queries flag for debugging client queries#327
fuziontech wants to merge 2 commits intomainfrom
feat/log-queries

Conversation

@fuziontech
Copy link
Member

Summary

  • Adds --log-queries flag / DUCKGRES_LOG_QUERIES env var / log_queries YAML config
  • When enabled, logs all incoming queries (simple + extended protocol) at Info level instead of Debug
  • Also logs transpiled SQL when it differs from the original, so you can see exactly what DuckDB receives

Useful for debugging why clients like Hex fail to pull schema — you can see the exact SQL they send without setting log-level=debug (which is extremely noisy).

Usage

# CLI flag
duckgres --log-queries

# Environment variable
DUCKGRES_LOG_QUERIES=true duckgres

# YAML config
log_queries: true

Test plan

  • go build compiles cleanly
  • Existing config resolution tests pass
  • Manual test: run with --log-queries and connect with psql, verify queries appear in stderr at Info level
  • Manual test: run without flag, verify queries only appear at Debug level

🤖 Generated with Claude Code

fuziontech and others added 2 commits March 18, 2026 16:12
Adds a `--log-queries` flag (+ `DUCKGRES_LOG_QUERIES` env var + `log_queries`
YAML config) that promotes query logging from Debug to Info level. This makes
it easy to see exactly what SQL a client is sending without needing to change
the global log level to debug (which is very noisy).

Logs both simple protocol queries and extended protocol prepared statements,
including transpiled output when it differs from the original.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant