Commit 8cc18b1
committed
psql-srv: Add integer_datetimes to PG ready message
A long, long time ago, in a galaxy far, far away, Postgres internally
represented `timestamp` and `interval` types as `doubles`. Around
version 8.4 (July 2009), this was changed to an `integer` for various
precision correctness issues.
As a result, Postgres would, and still does to this day, return a
`ParameterStatus` to clients on a new connection to declare if the
server is treating `timestamp` and `interval` types as `doubles`. This
status is named `integer_datetimes` and, since Postgres v10, always
returns `on` (meaning it's always returning 8-byte integers).
This distinction primarily matters then the server is asked to return
values in the binary format; text format just returns a string
representation of the value.
Some Postgres drivers still expect to see that `integer_datetimes`
parameter, and if they do not see it, will assume the server will
represent `timestamp` and `interval` types as `doubles`. This is what
happens with the PGJDBC driver. When the client asks for a `timestamp`
column, to be returned in binary format - which is what pgjdbc does
for named prepared statements - the connection will still check its
state to see if the `timestamp`'s 8-bytes should be interpreted as a
double or integer value (a `long`).
This CL adds an extra `ParameterStatus` in the new connection ready
message for the `integer_datetimes` parameter.
Fixes: #1365
Release-Note-Core: Fix bug affecting pgjdbc clients where
binary-formatted timestamp columns in result sets are interpreted
incorrectly.
Change-Id: Ia783b861b9dd8923e57a235cf097548c468648aa
Reviewed-on: https://gerrit.readyset.name/c/readyset/+/7936
Tested-by: Buildkite CI
Reviewed-by: Johnathan Davis <jcd@readyset.io>1 parent 44a1ed0 commit 8cc18b1
1 file changed
+5
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
226 | 230 | | |
227 | 231 | | |
228 | 232 | | |
| |||
1382 | 1386 | | |
1383 | 1387 | | |
1384 | 1388 | | |
| 1389 | + | |
1385 | 1390 | | |
1386 | 1391 | | |
1387 | 1392 | | |
| |||
0 commit comments