Understanding DateStyle guc in startup packet

Поиск
Список
Период
Сортировка
От Manav Kumar
Тема Understanding DateStyle guc in startup packet
Дата
Msg-id CAPhCW+-oyivUiBiP5nOMQNxQzXLnT62SvCZ1oq7rqZkHq34KGA@mail.gmail.com
обсуждение исходный текст
Ответы Re: Understanding DateStyle guc in startup packet
Список pgsql-jdbc

Manav Kumar mkumar@yugabyte.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  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

В списке pgsql-jdbc по дате отправления: