Skip to content
Browse files

perf: cache result of parsing server_version

Save version number after parsing it from string.
No need to recalculate it again.

Backend does not always send server_version_num, thus the driver falls back to string parsing.
See discussion on hackers list:

This improves Statement.setObject(int, UUID) which ckecks for server version.

closes #464
  • Loading branch information
zapov authored and vlsi committed Dec 26, 2015
1 parent 4f5d57c commit 9c43d27486c9980782147a9f11798793a53047be
Showing with 1 addition and 1 deletion.
  1. +1 −1 pgjdbc/src/main/java/org/postgresql/core/v3/
@@ -57,7 +57,7 @@ public String getServerVersion() {
public int getServerVersionNum() {
if (serverVersionNum != 0)
return serverVersionNum;
return Utils.parseServerVersionStr(serverVersion);
return serverVersionNum = Utils.parseServerVersionStr(serverVersion);

public synchronized boolean getStandardConformingStrings()

0 comments on commit 9c43d27

Please sign in to comment.