Hi All,
As the doc mentioned, the --with-extra-version can be a distribution package release number. But if I build the program like below configure:
./configure --prefix=/home/zhangchenxi/Workspace/c/.build/psql --enable-debug --enable-depend --enable-cassert --with-extra-version=.54321 CFLAGS=-O0
The configure goes well, and make goes well too. All things seems OK. But when using psql to connect to database, it emit a WARNING:
psql (14.2.54321, server 14.2.54321)
WARNING: psql major version 14, server major version 19.
Some psql features might not work.
Type "help" for help.
I made a some effort, and it seems some code in src/interfaces/libpq/fe-exec.c goes wrong.
…
1052 cnt = sscanf(value, "%d.%d.%d", &vmaj, &vmin, &vrev);
1053
1054 if (cnt == 3)
1055 {
1056 /* old style, e.g. 9.6.1 */
1057 conn->sversion = (100 * vmaj + vmin) * 100 + vrev;
1058 }
…
Because the extra version STRING only contains numbers, so the cnt will be 3, and then it will be reconginized as oly style version format.
So, may be we need to do more when cnt == 3:
…
1052 cnt = sscanf(value, "%d.%d.%d", &vmaj, &vmin, &vrev);
1053
1054 if (cnt == 3)
1055 {
1056 if (vmaj >= 10)
1057 {
1058 /* new style, e.g. 10.1 */
1059 conn->sversion = 100 * 100 * vmaj + vmin;
1060 }
1061 else
1062 {
1063 /* old style, e.g. 9.6.1 */
1064 conn->sversion = (100 * vmaj + vmin) * 100 + vrev;
1065 }
1066 }
…
Am I right?
But it still not able to solve if the extra version STRING like below:
./configure --prefix=/home/zhangchenxi/Workspace/c/.build/psql --enable-debug --enable-depend --enable-cassert --with-extra-version=54321 CFLAGS=-O0
the extra version STRING 54321 with no dot (.)
psql (14.254321, server 14.254321)
WARNING: psql major version 14, server major version 39.
Some psql features might not work.
Type "help" for help.
Jet C.X. ZHANG
Halo Tech Co.,Ltd. http://www.halodbtech.com