How to fix “ERROR: column relhasoids does not exist” in phpPgAdmin?
How to fix “ERROR: column relhasoids does not exist” in phpPgAdmin?
我正在使用 PostgreSql 的新版本更新 Linux 服务器,我在 phpPgAdmin 当我浏览 table.
Ubuntu 18.04.3 LTS 服务器 运行 Apache 2.4.41,PHP 7.3.11,当我更新到 PostgreSQL 12.0 和 phpPgAdmin 7.12.0 出现错误。使用 PostgreSQL 11.5 和 phpPgAdmin 5.6 我没有遇到这个问题。
我希望使用 phpPgAdmin 可视化存储在 table 中的数据,但实际输出是:
SQL error:
ERROR: column «relhasoids» does not exist
LINE 1: SELECT relhasoids FROM pg_catalog.pg_class WHERE relname='pr...
In statement:
SELECT relhasoids FROM pg_catalog.pg_class WHERE relname='product'
AND relnamespace = (SELECT oid FROM pg_catalog.pg_namespace WHERE nspname='public')
这是因为 phpPgAdmin 与 PostgreSQL v.12 不兼容。PostgreSQL v.12 已经删除了 relhasoids
列,因为 OID 的处理方式是新的。截至本文 post 时,pgPgAdmin 不支持 PostgreSQL v. 12(它是 not listed on the website)。您可能需要查看备用客户端。
另见 How to fix “ERROR: column c.relhasoids does not exist” in Postgres?
此列已不存在,因为您不能再使用 OID 创建表。
WITH ( storage_parameter [= value] [, ... ] )
This clause specifies optional storage parameters for a table or index; see Storage Parameters for more information. For backward-compatibility the WITH clause for a table can also include OIDS=FALSE to specify that rows of the new table should not contain OIDs (object identifiers), OIDS=TRUE is not supported anymore.
WITHOUT OIDS
This is backward-compatible syntax for declaring a table WITHOUT OIDS, creating a table WITH OIDS is not supported anymore.
编辑文件 /usr/share/phppgadmin/classes/database/Postgres.php 并注释 line 1045 to line 1054
错误消失:
function hasObjectID($table) {
$c_schema = $this->_schema;
$this->clean($c_schema);
$this->clean($table);
/*
$sql = "SELECT relhasoids FROM pg_catalog.pg_class WHERE relname='{$table}'
AND relnamespace = (SELECT oid FROM pg_catalog.pg_namespace WHERE nspname='{$c_schema}')";
$rs = $this->selectSet($sql);
if ($rs->recordCount() != 1) return null;
else {
$rs->fields['relhasoids'] = $this->phpBool($rs->fields['relhasoids']);
return $rs->fields['relhasoids'];
} */
}
我正在使用 PostgreSql 的新版本更新 Linux 服务器,我在 phpPgAdmin 当我浏览 table.
Ubuntu 18.04.3 LTS 服务器 运行 Apache 2.4.41,PHP 7.3.11,当我更新到 PostgreSQL 12.0 和 phpPgAdmin 7.12.0 出现错误。使用 PostgreSQL 11.5 和 phpPgAdmin 5.6 我没有遇到这个问题。
我希望使用 phpPgAdmin 可视化存储在 table 中的数据,但实际输出是:
SQL error:
ERROR: column «relhasoids» does not exist
LINE 1: SELECT relhasoids FROM pg_catalog.pg_class WHERE relname='pr...
In statement:
SELECT relhasoids FROM pg_catalog.pg_class WHERE relname='product'
AND relnamespace = (SELECT oid FROM pg_catalog.pg_namespace WHERE nspname='public')
这是因为 phpPgAdmin 与 PostgreSQL v.12 不兼容。PostgreSQL v.12 已经删除了 relhasoids
列,因为 OID 的处理方式是新的。截至本文 post 时,pgPgAdmin 不支持 PostgreSQL v. 12(它是 not listed on the website)。您可能需要查看备用客户端。
另见 How to fix “ERROR: column c.relhasoids does not exist” in Postgres?
此列已不存在,因为您不能再使用 OID 创建表。
WITH ( storage_parameter [= value] [, ... ] )
This clause specifies optional storage parameters for a table or index; see Storage Parameters for more information. For backward-compatibility the WITH clause for a table can also include OIDS=FALSE to specify that rows of the new table should not contain OIDs (object identifiers), OIDS=TRUE is not supported anymore.
WITHOUT OIDS
This is backward-compatible syntax for declaring a table WITHOUT OIDS, creating a table WITH OIDS is not supported anymore.
编辑文件 /usr/share/phppgadmin/classes/database/Postgres.php 并注释 line 1045 to line 1054
错误消失:
function hasObjectID($table) {
$c_schema = $this->_schema;
$this->clean($c_schema);
$this->clean($table);
/*
$sql = "SELECT relhasoids FROM pg_catalog.pg_class WHERE relname='{$table}'
AND relnamespace = (SELECT oid FROM pg_catalog.pg_namespace WHERE nspname='{$c_schema}')";
$rs = $this->selectSet($sql);
if ($rs->recordCount() != 1) return null;
else {
$rs->fields['relhasoids'] = $this->phpBool($rs->fields['relhasoids']);
return $rs->fields['relhasoids'];
} */
}