Understanding JDBC Behaviour

From: Manav Kumar <mkumar(at)yugabyte(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Understanding JDBC Behaviour
Date: 2025-05-17 12:35:00
Message-ID: CAPhCW+-bC8URy_vi5MBDj3c5yB0A40nbDy1sGHLqC3L+p+9HBQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Rather shouldn't the expected output should be
Postgres, DMY
Postgres, DMY //*Please correct me - *Even after the reset the default
value should be Postgres, DMY ?
I checked the official docs, and found the syntax above.
Looking forward to seeing your response! Please let me know if I should
post elsewhere.

Thanks
Manav

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alexander Korotkov 2025-05-18 11:03:49 Re: Incorrect calculation of path fraction value in MergeAppend
Previous Message jian he 2025-05-16 14:50:42 Re: BUG #18923: pg_dump 18beta1 fails to process complex table names