Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit69dc5ae

Browse files
committed
Teach libpq to decode server version correctly from future servers.
Beginning with the next development cycle, PG servers will report two-partnot three-part version numbers. Fix libpq so that it will compute thecorrect numeric representation of such server versions for reporting byPQserverVersion(). It's desirable to get this into the field andback-patched ASAP, so that older clients are more likely to understand thenew server version numbering by the time any such servers are in the wild.(The results with an old client would probably not be catastrophic anywayfor a released server; for example "10.1" would be interpreted as 100100which would be wrong in detail but would not likely cause an old client tomisbehave badly. But "10devel" or "10beta1" would result in sversion==0which at best would result in disabling all use of modern features.)Extracted from a patch by Peter Eisentraut; comments added by mePatch: <802ec140-635d-ad86-5fdf-d3af0e260c22@2ndquadrant.com>
1 parentfc509cd commit69dc5ae

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

‎src/interfaces/libpq/fe-exec.c

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -983,14 +983,31 @@ pqSaveParameterStatus(PGconn *conn, const char *name, const char *value)
983983

984984
cnt=sscanf(value,"%d.%d.%d",&vmaj,&vmin,&vrev);
985985

986-
if (cnt<2)
987-
conn->sversion=0;/* unknown */
988-
else
986+
if (cnt==3)
989987
{
990-
if (cnt==2)
991-
vrev=0;
988+
/* old style, e.g. 9.6.1 */
992989
conn->sversion= (100*vmaj+vmin)*100+vrev;
993990
}
991+
elseif (cnt==2)
992+
{
993+
if (vmaj >=10)
994+
{
995+
/* new style, e.g. 10.1 */
996+
conn->sversion=100*100*vmaj+vmin;
997+
}
998+
else
999+
{
1000+
/* old style without minor version, e.g. 9.6devel */
1001+
conn->sversion= (100*vmaj+vmin)*100;
1002+
}
1003+
}
1004+
elseif (cnt==1)
1005+
{
1006+
/* new style without minor version, e.g. 10devel */
1007+
conn->sversion=100*100*vmaj;
1008+
}
1009+
else
1010+
conn->sversion=0;/* unknown */
9941011
}
9951012
}
9961013

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp