psql --version
select version();
show server_version;
SHOW server_version_num;
或
SELECT current_setting('server_version_num');
SELECT current_setting(‘server_version_num’);返回类型为text,如果需要可以转换为interger
SELECT current_setting('server_version_num')::integer;