使用Navicat Premium 15访问PostgreSQL 16版本的库,报如下错误
ERROR: column "datlastsysoid" does not exist LINE 1: SELECT DISTINCT datlastsysoid FROM pg_database;
登录pg库查看
postgres=# SELECT DISTINCT datlastsysoid FROM pg_database; 2025-03-07 22:09:03.569 EST [62553] ERROR: column "datlastsysoid" does not exist at character 17 2025-03-07 22:09:03.569 EST [62553] STATEMENT: SELECT DISTINCT datlastsysoid FROM pg_database; ERROR: column "datlastsysoid" does not exist LINE 1: SELECT DISTINCT datlastsysoid FROM pg_database; ^ postgres=# \d pg_database; Table "pg_catalog.pg_database" Column | Type | Collation | Nullable | Default ----------------+-----------+-----------+----------+--------- oid | oid | | not null | datname | name | | not null | datdba | oid | | not null | encoding | integer | | not null | datlocprovider | "char" | | not null | datistemplate | boolean | | not null | datallowconn | boolean | | not null | datconnlimit | integer | | not null | datfrozenxid | xid | | not null | datminmxid | xid | | not null | dattablespace | oid | | not null | datcollate | text | C | not null | datctype | text | C | not null | daticulocale | text | C | | daticurules | text | C | | datcollversion | text | C | | datacl | aclitem[] | | | Indexes: "pg_database_oid_index" PRIMARY KEY, btree (oid), tablespace "pg_global" "pg_database_datname_index" UNIQUE CONSTRAINT, btree (datname), tablespace "pg_global" Tablespace: "pg_global"
确认没有了datlastsysoid列,通过查看文档确认从Postgres 15版本开始 pg_database表中删除了 datlastsysoid,但是可以通过查询dattablespace替代,使用二进制工具修改libcc.dll文件中的SELECT DISTINCT datlastsysoid部分语句为:SELECT DISTINCT dattablespace
然后重新启动Navicat,访问pg库正常

当然这个问题如果使用高版本的Navicat或者访问低版本的PostgreSQL库不会出现