From: | Manav Kumar <mkumar(at)yugabyte(dot)com> |
---|---|
To: | pgsql-jdbc(at)lists(dot)postgresql(dot)org, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
Subject: | Understanding DateStyle guc in startup packet |
Date: | 2025-05-19 11:30:54 |
Message-ID: | CAPhCW+-oyivUiBiP5nOMQNxQzXLnT62SvCZ1oq7rqZkHq34KGA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Manav Kumar <mkumar(at)yugabyte(dot)com>
Sat, May 17, 6:05 PM (2 days ago)
to pgsql-bugs
Hi Team,
I'm writing to clarify a syntax to pass the guc options in the startup
packt of the connection via JDBC.
Wrote below small java program:
Properties props = new Properties();
props.setProperty("options", "-c DateStyle=Postgres,DMY");
props.setProperty("user", "postgres");
props.setProperty("password", "postgres");
connection = DriverManager.getConnection(
"jdbc:postgresql://localhost:5432/postgres", props);
stmt1 = connection.createStatement();
ResultSet rs = stmt1.executeQuery("show DateStyle");
while (rs.next()) {
System.out.println(rs.getString(1));
}
stmt1.execute("reset DateStyle");
rs = stmt1.executeQuery("show DateStyle");
while (rs.next()) {
System.out.println(rs.getString(1));
}
The output I'm getting is:
ISO, DMY
ISO, DMY.
As explained by @Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> the driver forces
the value of DateStyle to remain ISO even though the client tries to set a
different value in the startup packet.
Can you please point me in the code where it happens or share briefly how
it has been implemented. I was testing a connection pool with pg and saw
the Postgres,DMY (client provided value) values coming in the startup
packet.
Best,
Manav
From | Date | Subject | |
---|---|---|---|
Next Message | Vladimir Sitnikov | 2025-05-19 12:23:11 | Re: Understanding DateStyle guc in startup packet |
Previous Message | Andrew Dunstan | 2025-03-29 18:53:53 | Re: PostgreSQL JDBC 42.7.5 returns an unexpected catalog name |