In the DuckDB C API, both TIMESTAMP and TIMESTAMP_TZ are stored as duckdb_timestamp (microseconds since 1970-01-01 UTC). When passing a Go time.Time to duckdb-go, it is converted to an instant using UnixMicro(), even if the target type is TIMESTAMP_TZ.
To force a specific DuckDB logical type for a query parameter (e.g., when DuckDB cannot infer the type or when you need high precision like TIMESTAMP_NS), use duckdb.Typed(value, typ).
Note: Bare time.Time values bind as TIMESTAMP_TZ by default.
start := time.Date(2024, time.April, 5, 0, 0, 0, 0, time.UTC)
end := time.Date(2024, time.April, 6, 0, 0, 0, 0, time.UTC)
row := db.QueryRow(`
SELECT COUNT(*)
FROM (VALUES (TIMESTAMP_NS '2024-04-05 12:00:00.000000001')) events_ns(ts)
WHERE ts >= ? AND ts < ?
`, duckdb.Typed(start, duckdb.TYPE_TIMESTAMP_NS), duckdb.Typed(end, duckdb.TYPE_TIMESTAMP_NS))