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

Luis Cedeño picture Luis Cedeño · Nov 8, 2019 · Viewed 9k times · Source

I'm updating a Linux server with a new version of PostgreSql and I have an Error Message in phpPgAdmin when I browse a table.

The Ubuntu 18.04.3 LTS server running Apache 2.4.41, PHP 7.3.11 and when I update to PostgreSQL 12.0 and phpPgAdmin 7.12.0 the error occurs. With PostgreSQL 11.5 and phpPgAdmin 5.6 I didn't have this problem.

I expect to visualize the data stored in the table using phpPgAdmin, but the actual output is:

    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')

Answer

Luis Cedeño picture Luis Cedeño · Nov 8, 2019

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