When running EXPLAIN ANALYZE on a query that has a TIMESTAMP WITH TIME ZONE parameter passed as a large integer (Unix timestamp in milliseconds or microseconds), the tool throws an error instead of executing the explain plan.
Steps to reproduce:
- Execute a query with a
TIMESTAMP WITH TIME ZONE parameter bound as a raw integer (e.g. 825505830505628)
- Open the query in the history/log view
- Press
x or X to run EXPLAIN / EXPLAIN ANALYZE
Error:
rpc error: code = Internal desc = explain: explain: query:
ERROR: date/time field value out of range: "825505830505628" (SQLSTATE 22008)
Expected behavior:
EXPLAIN ANALYZE should execute successfully, the same way the original query did (Duration: 1.2ms, Rows: 1).
Root cause (hypothesis):
The original query runs fine because the driver passes the argument as a native typed value. However, when sql-tap reconstructs the query for EXPLAIN ANALYZE, it substitutes the argument as a plain string literal 825505830505628 into a TIMESTAMP WITH TIME ZONE slot — PostgreSQL then tries to parse it as a date string and fails.
Environment:
- Tool:
sql-tap
- Database: PostgreSQL
- Argument value:
825505830505628 (likely Unix epoch in microseconds)
Yes, I used AI to generate text for issue reports :)

When running
EXPLAIN ANALYZEon a query that has aTIMESTAMP WITH TIME ZONEparameter passed as a large integer (Unix timestamp in milliseconds or microseconds), the tool throws an error instead of executing the explain plan.Steps to reproduce:
TIMESTAMP WITH TIME ZONEparameter bound as a raw integer (e.g.825505830505628)xorXto runEXPLAIN/EXPLAIN ANALYZEError:
Expected behavior:
EXPLAIN ANALYZEshould execute successfully, the same way the original query did (Duration: 1.2ms, Rows: 1).Root cause (hypothesis):
The original query runs fine because the driver passes the argument as a native typed value. However, when
sql-tapreconstructs the query forEXPLAIN ANALYZE, it substitutes the argument as a plain string literal825505830505628into aTIMESTAMP WITH TIME ZONEslot — PostgreSQL then tries to parse it as a date string and fails.Environment:
sql-tap825505830505628(likely Unix epoch in microseconds)Yes, I used AI to generate text for issue reports :)