Re: Understanding DateStyle guc in startup packet
От | Vladimir Sitnikov |
---|---|
Тема | Re: Understanding DateStyle guc in startup packet |
Дата | |
Msg-id | CAB=Je-Gznb3j_M--EAn9zW0cHLzgMg_YyWxWGM==g_kRfxEzrA@mail.gmail.com обсуждение исходный текст |
Ответ на | Understanding DateStyle guc in startup packet (Manav Kumar <mkumar@yugabyte.com>) |
Список | pgsql-jdbc |
Long story short: it might be nice to decouple pgjdbc from requiring DateStyle=ISO, however, it does not look like a walk in the park to me.
I guess here's the line that configures DateStyle ISO: https://github.com/pgjdbc/pgjdbc/blob/d9e20874590f59543c39a99b824e09344f00a813/pgjdbc/src/main/java/org/postgresql/core/v3/ConnectionFactoryImpl.java#L409
It looks like options come after DateStyle.
At the same time, for some reason related to COPY processing, the driver asserts DateStyle must start with ISO: https://github.com/pgjdbc/pgjdbc/issues/131
---
For historical reasons, pgjdbc often sends timestamps and dates as text-encoded literals, so it needs the backend to recognize the value properly.
The reason is that Java's `setTimestamp()` does not distinguish between timestamp and timestamptz, so the driver can't use Oid for timestamp/timestamptz,
so it falls back to text encoding with Oid "unknown".
I have not explored if the server would parse the timestamps appropriately.
---
At the same time, DateStyle might affect text representation of the timestamps, and the driver is not prepared to parse various flavours of timestamp representation.
A way out might be to make sure pgjdbc always requires binary encoding when receiving timestamp/timestamptz/date.
However, it might be trickier when processing arrays or structs as requiring all the arrays and structs to be in binary would take a bit of time as well.
Vladimir
В списке pgsql-jdbc по дате отправления: