pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@postgreSQL.org
Subject: Re: New version numbering practices
Date: Wed, 3 Aug 2016 12:12:19 -0400
Message-ID: <802ec140-635d-ad86-5fdf-d3af0e260c22@2ndquadrant.com> (raw)
In-Reply-To: <7684.1470066581@sss.pgh.pa.us>
References: <7684.1470066581@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 8/1/16 11:49 AM, Tom Lane wrote:
> Somebody needs to come up with a patch implementing this changeover.

Here is such a patch.  It does not yet implement:

> (External code will need some cue as
> to how to format displays from PG_VERSION_NUM, so we should have a hard
> and fast rule that major >= 10 means new style.)

e.g., in psql, but that's a UI issue that can be sorted out.

One hiccup I found is that server_version_num is not sent to clients.
Instead, libpq assembles the numeric version number itself from the
string version, and it will fail if it sees only one number (e.g.,
10devel).  It will then set the version number to 0 for "unknown".
Client code such as psql and pg_dump is coded so that it will then fall
back to code for the oldest server version it happens to support (less
than 8.1 at times).  So in other words, old psql plus new server up
until production release will have many \d commands failing.  Once the
release becomes 10.0, it will work again.  (It will still think in terms
of three-component versions, but it won't make a difference in practice.)

Some possibilities to make this slightly better:

- Report server_version_num to clients, and use that.

- If libpq can't parse the version number, it should set it to its own
version number instead of 0.  Alternatively,

- If psql sees a server version number of 0, it should assume its own
version number.

- Similarly for pg_dump, although old pg_dump with new server is not
really supported anyway.


Apart from some UI issues, the attached patch passes check-world.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

0001-Stamp-version-10devel.patch (text/x-patch, 16.1K) download From 9d9513ea7293be262ea691ad8057ad81836ef8c4 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter_e@gmx.net> Date: Wed, 3 Aug 2016 11:52:04 -0400 Subject: [PATCH] Stamp version 10devel WIP --- configure | 20 ++++++++++---------- configure.in | 4 ++-- doc/bug.template | 2 +- doc/src/sgml/runtime.sgml | 31 ++++++++++++++++++++----------- src/backend/catalog/genbki.pl | 4 ++-- src/backend/utils/init/miscinit.c | 18 +++++++----------- src/bin/pg_upgrade/check.c | 6 +++--- src/bin/pg_upgrade/server.c | 2 +- src/include/pg_config.h.win32 | 8 ++++---- src/interfaces/libpq/fe-exec.c | 17 +++++++++++------ src/interfaces/libpq/libpq.rc.in | 8 ++++---- src/port/win32ver.rc | 4 ++-- src/tools/version_stamp.pl | 14 ++++++-------- 13 files changed, 73 insertions(+), 65 deletions(-) diff --git a/configure b/configure index b49cc11..45c8eef 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for PostgreSQL 9.6beta3. +# Generated by GNU Autoconf 2.69 for PostgreSQL 10devel. # # Report bugs to <pgsql-bugs@postgresql.org>. # @@ -582,8 +582,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='PostgreSQL' PACKAGE_TARNAME='postgresql' -PACKAGE_VERSION='9.6beta3' -PACKAGE_STRING='PostgreSQL 9.6beta3' +PACKAGE_VERSION='10devel' +PACKAGE_STRING='PostgreSQL 10devel' PACKAGE_BUGREPORT='pgsql-bugs@postgresql.org' PACKAGE_URL='' @@ -1398,7 +1398,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures PostgreSQL 9.6beta3 to adapt to many kinds of systems. +\`configure' configures PostgreSQL 10devel to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1463,7 +1463,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of PostgreSQL 9.6beta3:";; + short | recursive ) echo "Configuration of PostgreSQL 10devel:";; esac cat <<\_ACEOF @@ -1615,7 +1615,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -PostgreSQL configure 9.6beta3 +PostgreSQL configure 10devel generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2326,7 +2326,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by PostgreSQL $as_me 9.6beta3, which was +It was created by PostgreSQL $as_me 10devel, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2711,7 +2711,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. configure_args=$ac_configure_args -PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'` +PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\)'` cat >>confdefs.h <<_ACEOF @@ -16433,7 +16433,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by PostgreSQL $as_me 9.6beta3, which was +This file was extended by PostgreSQL $as_me 10devel, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16503,7 +16503,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -PostgreSQL config.status 9.6beta3 +PostgreSQL config.status 10devel configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.in b/configure.in index 5da4f74..c878b4e 100644 --- a/configure.in +++ b/configure.in @@ -17,7 +17,7 @@ dnl Read the Autoconf manual for details. dnl m4_pattern_forbid(^PGAC_)dnl to catch undefined macros -AC_INIT([PostgreSQL], [9.6beta3], [pgsql-bugs@postgresql.org]) +AC_INIT([PostgreSQL], [10devel], [pgsql-bugs@postgresql.org]) m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_fatal([Autoconf version 2.69 is required. Untested combinations of 'autoconf' and PostgreSQL versions are not @@ -29,7 +29,7 @@ AC_CONFIG_AUX_DIR(config) AC_PREFIX_DEFAULT(/usr/local/pgsql) AC_SUBST(configure_args, [$ac_configure_args]) -[PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`] +[PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\)'`] AC_SUBST(PG_MAJORVERSION) AC_DEFINE_UNQUOTED(PG_MAJORVERSION, "$PG_MAJORVERSION", [PostgreSQL major version as a string]) diff --git a/doc/bug.template b/doc/bug.template index 69679b9..8e7401e 100644 --- a/doc/bug.template +++ b/doc/bug.template @@ -27,7 +27,7 @@ System Configuration: Operating System (example: Linux 2.4.18) : - PostgreSQL version (example: PostgreSQL 9.6beta3): PostgreSQL 9.6beta3 + PostgreSQL version (example: PostgreSQL 10devel): PostgreSQL 10devel Compiler used (example: gcc 3.3.5) : diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index 310bf73..9838400 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -1601,17 +1601,26 @@ <title>Upgrading a <productname>PostgreSQL</> Cluster</title> </para> <para> - <productname>PostgreSQL</> major versions are represented by the - first two digit groups of the version number, e.g., 8.4. - <productname>PostgreSQL</> minor versions are represented by the - third group of version digits, e.g., 8.4.2 is the second minor - release of 8.4. Minor releases never change the internal storage - format and are always compatible with earlier and later minor - releases of the same major version number, e.g., 8.4.2 is compatible - with 8.4, 8.4.1 and 8.4.6. To update between compatible versions, - you simply replace the executables while the server is down and - restart the server. The data directory remains unchanged &mdash; - minor upgrades are that simple. + Current <productname>PostgreSQL</productname> version numbers consist of a + major and a minor version number. For example, in the version number 10.1, + the 10 is the major version number and the 1 is the minor version number, + meaning this would be the first minor release of the major release 10. For + releases before <productname>PostgreSQL</productname> version 10.0, version + numbers consist of three numbers, for example, 9.5.3. In those cases, the + major version consists of the first two digit groups of the version number, + e.g., 9.5, and the minor version is the third number, e.g., 3, meaning this + would be the third minor release of the major release 9.5. + </para> + + <para> + Minor releases never change the internal storage format and are always + compatible with earlier and later minor releases of the same major version + number. For example, version 10.1 is compatible with version 10.0 and + version 10.6. Similarly, for example, 9.5.3 is compatible with 9.5.0, + 9.5.1, and 9.5.6. To update between compatible versions, you simply + replace the executables while the server is down and restart the server. + The data directory remains unchanged &mdash; minor upgrades are that + simple. </para> <para> diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl index 54a14e5..26d1652 100644 --- a/src/backend/catalog/genbki.pl +++ b/src/backend/catalog/genbki.pl @@ -43,8 +43,8 @@ elsif ($arg =~ /^--set-version=(.*)$/) { $major_version = $1; - die "Version must be in format nn.nn.\n" - if !($major_version =~ /^\d+\.\d+$/); + die "Invalid version string.\n" + if !($major_version =~ /^\d+$/); } else { diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index d4625a6..f6dd96f 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -1334,16 +1334,12 @@ ValidatePgVersion(const char *path) char full_path[MAXPGPATH]; FILE *file; int ret; - long file_major, - file_minor; - long my_major = 0, - my_minor = 0; + long file_major; + long my_major = 0; char *endptr; const char *version_string = PG_VERSION; my_major = strtol(version_string, &endptr, 10); - if (*endptr == '.') - my_minor = strtol(endptr + 1, NULL, 10); snprintf(full_path, sizeof(full_path), "%s/PG_VERSION", path); @@ -1362,8 +1358,8 @@ ValidatePgVersion(const char *path) errmsg("could not open file \"%s\": %m", full_path))); } - ret = fscanf(file, "%ld.%ld", &file_major, &file_minor); - if (ret != 2) + ret = fscanf(file, "%ld", &file_major); + if (ret != 1) ereport(FATAL, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("\"%s\" is not a valid data directory", @@ -1374,13 +1370,13 @@ ValidatePgVersion(const char *path) FreeFile(file); - if (my_major != file_major || my_minor != file_minor) + if (my_major != file_major) ereport(FATAL, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("database files are incompatible with server"), - errdetail("The data directory was initialized by PostgreSQL version %ld.%ld, " + errdetail("The data directory was initialized by PostgreSQL version %ld, " "which is not compatible with this version %s.", - file_major, file_minor, version_string))); + file_major, version_string))); } /*------------------------------------------------------------------------- diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c index 324760b..45f34aa 100644 --- a/src/bin/pg_upgrade/check.c +++ b/src/bin/pg_upgrade/check.c @@ -1077,8 +1077,8 @@ get_bin_version(ClusterInfo *cluster) char cmd[MAXPGPATH], cmd_output[MAX_STRING]; FILE *output; - int pre_dot, - post_dot; + int pre_dot = 0, + post_dot = 0; snprintf(cmd, sizeof(cmd), "\"%s/pg_ctl\" --version", cluster->bindir); @@ -1093,7 +1093,7 @@ get_bin_version(ClusterInfo *cluster) if (strchr(cmd_output, '\n') != NULL) *strchr(cmd_output, '\n') = '\0'; - if (sscanf(cmd_output, "%*s %*s %d.%d", &pre_dot, &post_dot) != 2) + if (sscanf(cmd_output, "%*s %*s %d.%d", &pre_dot, &post_dot) < 1) pg_fatal("could not get version from %s\n", cmd); cluster->bin_version = (pre_dot * 100 + post_dot) * 100; diff --git a/src/bin/pg_upgrade/server.c b/src/bin/pg_upgrade/server.c index 02b736d..67dba2e 100644 --- a/src/bin/pg_upgrade/server.c +++ b/src/bin/pg_upgrade/server.c @@ -153,7 +153,7 @@ get_major_server_version(ClusterInfo *cluster) if (fscanf(version_fd, "%63s", cluster->major_version_str) == 0 || sscanf(cluster->major_version_str, "%d.%d", &integer_version, - &fractional_version) != 2) + &fractional_version) < 1) pg_fatal("could not get version from %s\n", cluster->pgdata); fclose(version_fd); diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index 084bd67..8892c3c 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -554,10 +554,10 @@ #define PACKAGE_NAME "PostgreSQL" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "PostgreSQL 9.6beta3" +#define PACKAGE_STRING "PostgreSQL 10devel" /* Define to the version of this package. */ -#define PACKAGE_VERSION "9.6beta3" +#define PACKAGE_VERSION "10devel" /* Define to the name of a signed 128-bit integer type. */ #undef PG_INT128_TYPE @@ -566,10 +566,10 @@ #define PG_INT64_TYPE long long int /* PostgreSQL version as a string */ -#define PG_VERSION "9.6beta3" +#define PG_VERSION "10devel" /* PostgreSQL version as a number */ -#define PG_VERSION_NUM 90600 +#define PG_VERSION_NUM 100000 /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "postgresql" diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 2621767..36d2302 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -983,14 +983,19 @@ pqSaveParameterStatus(PGconn *conn, const char *name, const char *value) cnt = sscanf(value, "%d.%d.%d", &vmaj, &vmin, &vrev); - if (cnt < 2) - conn->sversion = 0; /* unknown */ - else - { - if (cnt == 2) - vrev = 0; + if (cnt == 3) conn->sversion = (100 * vmaj + vmin) * 100 + vrev; + else if (cnt == 2) + { + if (vmaj >= 10) + conn->sversion = 100 * 100 * vmaj + vmin; + else + conn->sversion = (100 * vmaj + vmin) * 100; } + else if (cnt == 1) + conn->sversion = 100 * 100 * vmaj; + else + conn->sversion = 0; /* unknown */ } } diff --git a/src/interfaces/libpq/libpq.rc.in b/src/interfaces/libpq/libpq.rc.in index e41a1a2..0d6f704 100644 --- a/src/interfaces/libpq/libpq.rc.in +++ b/src/interfaces/libpq/libpq.rc.in @@ -1,8 +1,8 @@ #include <winver.h> VS_VERSION_INFO VERSIONINFO - FILEVERSION 9,6,0,0 - PRODUCTVERSION 9,6,0,0 + FILEVERSION 10,0,0,0 + PRODUCTVERSION 10,0,0,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0 FILEOS VOS__WINDOWS32 @@ -15,13 +15,13 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "PostgreSQL Access Library\0" - VALUE "FileVersion", "9.6.0\0" + VALUE "FileVersion", "10.0\0" VALUE "InternalName", "libpq\0" VALUE "LegalCopyright", "Copyright (C) 2016\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "libpq.dll\0" VALUE "ProductName", "PostgreSQL\0" - VALUE "ProductVersion", "9.6.0\0" + VALUE "ProductVersion", "10.0\0" END END BLOCK "VarFileInfo" diff --git a/src/port/win32ver.rc b/src/port/win32ver.rc index c21b74c..3ce0923 100644 --- a/src/port/win32ver.rc +++ b/src/port/win32ver.rc @@ -2,8 +2,8 @@ #include "pg_config.h" VS_VERSION_INFO VERSIONINFO - FILEVERSION 9,6,0,0 - PRODUCTVERSION 9,6,0,0 + FILEVERSION 10,0,0,0 + PRODUCTVERSION 10,0,0,0 FILEFLAGSMASK 0x17L FILEFLAGS 0x0L FILEOS VOS_NT_WINDOWS32 diff --git a/src/tools/version_stamp.pl b/src/tools/version_stamp.pl index cc68545..3edd7be 100755 --- a/src/tools/version_stamp.pl +++ b/src/tools/version_stamp.pl @@ -22,8 +22,7 @@ # Major version is hard-wired into the script. We update it when we branch # a new development version. -$major1 = 9; -$major2 = 6; +$majorversion = 10; # Validate argument and compute derived variables $minor = shift; @@ -60,7 +59,6 @@ } # Create various required forms of the version number -$majorversion = $major1 . "." . $major2; if ($dotneeded) { $fullversion = $majorversion . "." . $minor; @@ -70,7 +68,7 @@ $fullversion = $majorversion . $minor; } $numericversion = $majorversion . "." . $numericminor; -$padnumericversion = sprintf("%d%02d%02d", $major1, $major2, $numericminor); +$padnumericversion = sprintf("%d%04d", $majorversion, $numericminor); # Get the autoconf version number for eventual nag message # (this also ensures we're in the right directory) @@ -110,15 +108,15 @@ ); sed_file("src/interfaces/libpq/libpq.rc.in", -"-e 's/FILEVERSION [0-9]*,[0-9]*,[0-9]*,0/FILEVERSION $major1,$major2,$numericminor,0/' " - . "-e 's/PRODUCTVERSION [0-9]*,[0-9]*,[0-9]*,0/PRODUCTVERSION $major1,$major2,$numericminor,0/' " +"-e 's/FILEVERSION [0-9]*,[0-9]*,[0-9]*,0/FILEVERSION $majorversion,0,$numericminor,0/' " + . "-e 's/PRODUCTVERSION [0-9]*,[0-9]*,[0-9]*,0/PRODUCTVERSION $majorversion,0,$numericminor,0/' " . "-e 's/VALUE \"FileVersion\", \"[0-9.]*/VALUE \"FileVersion\", \"$numericversion/' " . "-e 's/VALUE \"ProductVersion\", \"[0-9.]*/VALUE \"ProductVersion\", \"$numericversion/'" ); sed_file("src/port/win32ver.rc", -"-e 's/FILEVERSION [0-9]*,[0-9]*,[0-9]*,0/FILEVERSION $major1,$major2,$numericminor,0/' " - . "-e 's/PRODUCTVERSION [0-9]*,[0-9]*,[0-9]*,0/PRODUCTVERSION $major1,$major2,$numericminor,0/'" +"-e 's/FILEVERSION [0-9]*,[0-9]*,[0-9]*,0/FILEVERSION $majorversion,0,$numericminor,0/' " + . "-e 's/PRODUCTVERSION [0-9]*,[0-9]*,[0-9]*,0/PRODUCTVERSION $majorversion,0,$numericminor,0/'" ); print "Stamped these files with version number $fullversion:\n$fixedfiles"; -- 2.9.2

view thread (42+ messages)  latest in thread

Message-ID: <802ec140-635d-ad86-5fdf-d3af0e260c22@2ndquadrant.com>
Permalink:  ../802ec140-635d-ad86-5fdf-d3af0e260c22@2ndquadrant.com/
Also on:    postgresql.org/message-id/802ec140-635d-ad86-5fdf-d3af0e260c22@2ndquadrant.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, tgl@sss.pgh.pa.us
  Subject: Re: New version numbering practices
  In-Reply-To: <802ec140-635d-ad86-5fdf-d3af0e260c22@2ndquadrant.com>
  References: <7684.1470066581@sss.pgh.pa.us> <802ec140-635d-ad86-5fdf-d3af0e260c22@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox