Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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')
like image 336
Luis Cedeño Avatar asked Nov 07 '19 23:11

Luis Cedeño


People also ask

Where column does not exist Postgres?

The column does not exist exception occurs in PostgreSQL when we have not used a specified column name while doing any operations. Also, it occurs when we have not used a double quote to the mismatch case letter column name in PostgreSQL.

What is PostgreSQL version?

PostgreSQL 15.1, 14.6, 13.9, 12.13, 11.18, and 10.23 Released! 2022-11-10.


2 Answers

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'];
    } */
}
like image 64
Luis Cedeño Avatar answered Oct 22 '22 04:10

Luis Cedeño


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.

like image 33
Islingre Avatar answered Oct 22 '22 04:10

Islingre