On Sun, Apr 2, 2017 at 12:29 PM, Fabien COELHO <coe...@cri.ensmp.fr> wrote:
> > Hello Corey, > > I'm anxious to help with these patches, but they seem a bit of a moving >> target. Happy to jump in and review as soon as we've settled on what >> should >> be done. >> > > The "v3" I sent basically adds both client & server version numbers in > client-side variables, basically same code as suggested by Pavel for the > server version, and some documentation. > patch applies via patch -p1 Works as advertised. # \echo SERVER_VERSION_NAME SERVER_VERSION_NAME # \echo :SERVER_VERSION_NAME 10.0 # \echo :SERVER_VERSION_NUM 100000 # \echo :VERSION_NUM 100000 The new documentation is clear, and accurately reflects current name style. Looking at #define STRINGIFY(), I got curious where else STRINGIFY was used: $ git grep STRINGIFY src/bin/psql/startup.c:#define STRINGIFY2(symbol) #symbol src/bin/psql/startup.c:#define STRINGIFY(symbol) STRINGIFY2(symbol) src/bin/psql/startup.c: SetVariable(pset.vars, "VERSION_NUM", STRINGIFY(PG_VERSION_NUM)); src/tools/msvc/Solution.pm:s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY(z)\n#define PG_VERSION_STR "PostgreSQL $self->{strver}$extraver, compiled by Visual C++ build " __STRINGIFY2(_MSC_VER) ", $bits-bit"}; Without digging too deep, it seems like the redefinition wouldn't be harmful, but it might make sense to not use the name STRINGIFY() if only to avoid confusion with Solution.pm. > The questions are: > > - which version should be provided (10.0 100000 ...) > A fixed length string without decimals seems best for the multitude of tools that will want to manipulate that data. > - how should they be named? > > In v3 there is VERSION{,_NAME,_NUM} for client and > SERVER_VERSION_{NUM,NAME} or SVERSION_NUM suggested > by Pavel for server. > SERVER_VERSION_* is good. VERSION_* is ok. Would CLIENT_VERSION_* or PSQL_VERSION_* be better? > - how desirable/useful is it to have this in 10? > Extensions and extension-ish packages will love the _NUM vars. The sooner the better. There's a lesser need for the _NAME vars.