How to fix “ERROR: column relhasoids does not exist” in phpPgAdmin? How to fix “ERROR: column relhasoids does not exist” in phpPgAdmin? postgresql postgresql

How to fix “ERROR: column relhasoids does not exist” in phpPgAdmin?


Editing the file /usr/share/phppgadmin/classes/database/Postgres.php and comment line 1045 to line 1054 the error disappears:

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'];    } */}


This column does not exist anymore, since you cannot create tables with OID any longer.

From the documentation:

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.


This is because phpPgAdmin is not compatible with PostgreSQL v. 12. PostgreSQL v. 12 has removed the relhasoids column because of the new way that OIDs are handled. As of the time of this post, pgPgAdmin does not support PostgreSQL v. 12 (it is not listed on the website). You may need to look into alternate clients.

See also How to fix “ERROR: column c.relhasoids does not exist” in Postgres?