public inbox for [email protected]
help / color / mirror / Atom feedFrom: Vladimir Sitnikov <[email protected]>
To: Manav Kumar <[email protected]>
Cc: [email protected]
Cc: Laurenz Albe <[email protected]>
Subject: Re: Understanding DateStyle guc in startup packet
Date: Mon, 19 May 2025 15:23:11 +0300
Message-ID: <CAB=Je-Gznb3j_M--EAn9zW0cHLzgMg_YyWxWGM==g_kRfxEzrA@mail.gmail.com> (raw)
In-Reply-To: <CAPhCW+-oyivUiBiP5nOMQNxQzXLnT62SvCZ1oq7rqZkHq34KGA@mail.gmail.com>
References: <CAPhCW+-oyivUiBiP5nOMQNxQzXLnT62SvCZ1oq7rqZkHq34KGA@mail.gmail.com>
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/...
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
view thread (7+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Understanding DateStyle guc in startup packet
In-Reply-To: <CAB=Je-Gznb3j_M--EAn9zW0cHLzgMg_YyWxWGM==g_kRfxEzrA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox