skip to Main Content

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

3

Answers


  1. Chosen as BEST ANSWER

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

  2. 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?

    Login or Signup to reply.
  3. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search