Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uGyiC-00B5je-1T for pgsql-jdbc@arkaria.postgresql.org; Mon, 19 May 2025 11:31:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uGyi9-00FAVc-AN for pgsql-jdbc@arkaria.postgresql.org; Mon, 19 May 2025 11:31:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uGyi8-00FAVR-WE for pgsql-jdbc@lists.postgresql.org; Mon, 19 May 2025 11:31:13 +0000 Received: from mail-qv1-xf33.google.com ([2607:f8b0:4864:20::f33]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uGyi2-002fLN-2z for pgsql-jdbc@lists.postgresql.org; Mon, 19 May 2025 11:31:10 +0000 Received: by mail-qv1-xf33.google.com with SMTP id 6a1803df08f44-6f0c30a1cf8so51778556d6.2 for ; Mon, 19 May 2025 04:31:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yugabyte.com; s=google; t=1747654265; x=1748259065; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=h+e5bgLYz1oiAjcOFzNaGFij+07ozGqUxJVH/6LYdc4=; b=SEKLphTBSP4FRoUKe5HVlAcuS620E4WikHbqnp7f/Tyk7slxME+EEmIhWeB7bQAxZn sn2XSMr3A01rzFUWi7GPg1Nt9bVJZ3sOXt+oB14gnjVTef/H9+qO82+mFaFIGWU1qBpY q0vv7pYUHzy0hT2zSgHSFAzGQYRsKVrFLbLqc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747654265; x=1748259065; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=h+e5bgLYz1oiAjcOFzNaGFij+07ozGqUxJVH/6LYdc4=; b=t5CHxD8QRGEzKIoOgz2hEYRizI/JsTuHeCbcEsK3gze1918I1+RO5+8+UoK1JuhHMU BhYn+n2C2iNsNEaTwIZC2z7QG05z0rDZibYG/RhL3c3FVSTAg48+FNd7tjQZh4SFsB1P IRFMCB6OTMCuLt4BtbdokNDrpwtoVQJgPMc/gglEMOGilYw+EQI/Sb0myaG9jvjA6yBb 3pC2lkDTtCmqsyiCLkvlK9M7RbOIUkvs4nfySYnIQ9HZ2QE4H75HLaZdU+Wt++T4dy/4 LDWQhNRNotrtpwYZsHJIWJzQZCfPA4g7+SF1tjmic5j2ByXul5saEjsTE+tvJETW+Ufn jBUA== X-Gm-Message-State: AOJu0YwQc4Hyr58pLzzuSeMHQ/xhJqOCm1yrcA20mG0xwIL8Z+HGxe+Z 0wFom/Kz2PTtasAuJmtLFHHce2w/9dL/uFX9BXQbnW8vC9LbwpmuamCKGTNgGZJWKZVyNOxm+6v mfuEZJ8T2NgT2ZH25KNIITdWvR/oWyLDAoZKfQ9aTNCggCUGxouP5dac= X-Gm-Gg: ASbGnctRCzpgPwdKhCaQtm2acBufcApsGBRPCj8RGH+ra2J9UWlWm1rPKCPYbhll+fQ CY6jo7BRqVatK/ByjLdETN6Mvdp04bLzMt0d3tzDORD1qPIZ63eowIXmFxIouh7WpXkI5T/OMKP /ym5JEOxfP3IZjcRwrsCxLuL63gPHUuL6vkVrvyrIcx7Po5hREVbSNw0lNtjhX0j3Jg4I= X-Google-Smtp-Source: AGHT+IEwe6tva7Hj2I9Eu6pgg0aJIFfZrpxAGeztwg8W0sJnm7yMSHcLnxGRXg9cXHJpkqg+B9k1pcpYDtkjclVdtUs= X-Received: by 2002:a05:6214:2403:b0:6cb:ee08:c1e8 with SMTP id 6a1803df08f44-6f8b0884e1cmr222445436d6.23.1747654265161; Mon, 19 May 2025 04:31:05 -0700 (PDT) MIME-Version: 1.0 From: Manav Kumar Date: Mon, 19 May 2025 17:00:54 +0530 X-Gm-Features: AX0GCFvEDEcSujUyErQGNnBUXTXfw8_Gyz1RIJr7lFw3jYZeVQWEPhHXp3JkZvk Message-ID: Subject: Understanding DateStyle guc in startup packet To: pgsql-jdbc@lists.postgresql.org, Laurenz Albe Content-Type: multipart/alternative; boundary="000000000000aa77c806357b7745" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000aa77c806357b7745 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Manav Kumar Sat, May 17, 6:05=E2=80=AFPM (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 =3D new Properties(); props.setProperty("options", "-c DateStyle=3DPostgres,DMY"); props.setProperty("user", "postgres"); props.setProperty("password", "postgres"); connection =3D DriverManager.getConnection( "jdbc:postgresql://localhost:5432/postgres", props); stmt1 =3D connection.createStatement(); ResultSet rs =3D stmt1.executeQuery("show DateStyle"); while (rs.next()) { System.out.println(rs.getString(1)); } stmt1.execute("reset DateStyle"); rs =3D 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 --000000000000aa77c806357b7745 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
<= td colspan=3D"3">

Manav Kumar=C2=A0= <mkumar@yugabyte.com>

Sat, May 17, 6:05=E2=80=AFPM (2 days ago)
<= /td>
3D""
to=C2=A0pgsql-bugs
3D""
<= div class=3D"gmail-">
<= div dir=3D"ltr">Hi=C2=A0Team,
I'm writing to clarify=C2=A0a syntax = to pass the guc options in the startup packt of the connection via JDBC.=C2= =A0


Wrote below small java program:=

Properties props =3D new Properties();
props.setProperty("options", "-c DateStyle=3DPostgres,DMY");
props.setProperty("user", "postgres");
<= span style=3D"color:rgb(156,220,254)">props.setProperty("password= ", &quo= t;postgres");
connection =3D DriverManage= r.getConnection(
"jdbc:postgresql://loc= alhost:5432/postgres", props);

stmt1 =3D connection.createStatement();
ResultSet rs =3D stmt1.executeQuery(&quo= t;show DateStyle");
while (rs.next()) = {
S= ystem.out.println(rs.getString(1));
}
stmt1.execute("reset DateStyle");
rs =3D stmt1.executeQue= ry("sho= w DateStyle");
while (rs.= next()) {
System.out.printl= n(rs.= getString(1<= span style=3D"color:rgb(180,180,180)">));
}

The output I'm getting is:
ISO, DMY
ISO, DMY.=

As explained by=C2=A0@Laurenz Albe=C2=A0 the driver forces the value of DateStyle to= remain ISO even though the client tries to set a different value in the st= artup packet.

Can you please point me in the code = where it happens or share briefly how it has been=C2=A0implemented. I was t= esting a connection pool with pg and saw the Postgres,DMY (client provided = value) values coming in the startup packet.

Best,<= /div>
Manav
--000000000000aa77c806357b7745--