Skip to content

Commit

Permalink
feat: don't force send extra_float_digits for PostgreSQL >= 12 (pgjdb…
Browse files Browse the repository at this point in the history
  • Loading branch information
damienb-opt authored Nov 14, 2024
1 parent 47fed64 commit bbe2a4a
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,11 @@ private List<StartupParam> getParametersForStartup(String user, String database,

if (assumeVersion.getVersionNum() >= ServerVersion.v9_0.getVersionNum()) {
// User is explicitly telling us this is a 9.0+ server so set properties here:
paramList.add(new StartupParam("extra_float_digits", "3"));
if (assumeVersion.getVersionNum() < ServerVersion.v12.getVersionNum()) {
// extra_float_digits is meaningless in this case starting from v12
// see note on https://www.postgresql.org/docs/current/runtime-config-client.html#GUC-EXTRA-FLOAT-DIGITS
paramList.add(new StartupParam("extra_float_digits", "3"));
}
String appName = PGProperty.APPLICATION_NAME.getOrDefault(info);
if (appName != null) {
paramList.add(new StartupParam("application_name", appName));
Expand Down Expand Up @@ -921,7 +925,7 @@ private void runInitialQueries(QueryExecutor queryExecutor, Properties info)
SetupQueryRunner.run(queryExecutor, "BEGIN", false);
}

if (dbVersion >= ServerVersion.v9_0.getVersionNum()) {
if (dbVersion >= ServerVersion.v9_0.getVersionNum() && dbVersion < ServerVersion.v12.getVersionNum()) {
SetupQueryRunner.run(queryExecutor, "SET extra_float_digits = 3", false);
}

Expand Down

0 comments on commit bbe2a4a

Please sign in to comment.