=> SELECT version();version--------------------------------------------------------------------------------------------------------------PostgreSQL 9.2.9 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4), 64-bit
=> SHOW server_version;server_version----------------9.2.9
=> SHOW server_version_num;server_version_num--------------------90209
/** This is a C code from pg_dump source.* It will do something if PostgreSQL remote version (server) is lower than 9.1.0*/if (fout->remoteVersion < 90100)/** Do something...*/
$ sudo su postgres -c "psql"psql (12.8 (Ubuntu 12.8-0ubuntu0.20.04.1))
我读这个是因为客户端和服务器都在版本12。
在我将Ubuntu从20.04升级到21.04之后:
$ sudo su postgres -c "psql"psql (13.4 (Ubuntu 13.4-0ubuntu0.21.04.1), server 12.8 (Ubuntu 12.8-0ubuntu0.20.04.1))
它清楚地告诉我客户端在版本13上,但服务器仍然在12上,正如我确认的那样:
$ pg_lsclustersVer Cluster Port Status Owner Data directory Log file12 main 5432 online postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
$ sudo su postgres -c "psql"psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))Type "help" for help.
postgres=#
再次,我将其解释为客户端和服务器都在版本14上,再次确认:
$ pg_lsclustersVer Cluster Port Status Owner Data directory Log file12 main 5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log14 main 5433 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log