Fix ‘ERROR: column “spclocation” does not exist’ in phpPgAdmin

I was going to create a new database with phpPgAdmin and it crashed with this error:

ERROR:  column "spclocation" does not exist
LINE 1: ...pg_catalog.pg_get_userbyid(spcowner) AS spcowner, spclocatio...
                                                             ^

php-postgresql

We’ll have to add some code to phpPgAdmin to fix this. In my case this worked for phpPgAdmin 5.0.4 and PostgreSQL 9.3 but if you have for example PostgreSQL 9.2 just change the number. It should work.

  1. Open your phpPgAdmin location and change to /classes/database.
  2. Open Connection.php and add a case line for your PostgreSQL version:
    // Detect version and choose appropriate database driver
    switch (substr($version,0,3)) {
        case '9.3': return 'Postgres93'; break;
        case '8.4': return 'Postgres'; break;
        case '8.3': return 'Postgres83'; break;
        case '8.2': return 'Postgres82'; break;
        case '8.1': return 'Postgres81'; break;
        case '8.0':
        case '7.5': return 'Postgres80'; break;
        case '7.4': return 'Postgres74'; break;
    }
  3. Copy Postgres84.php to Postgres93.php.
  4. Open Postgres.php and copy functions getTablespaces and getTablespace.
  5. Open Postgres93.php and change class name to Postgres93 and $major_version variable value to 9.3.
  6. Also in Postgres93.php paste the functions you copied before inside the class.
  7. Replace ", spclocation," with ", pg_tablespace_location(oid) as spclocation," in both functions.

Ref: http://stackoverflow.com/questions/13467949/error-on-creating-database-in-phppgadmin

You might also like

Symfony2 – ErrorException: Notice: serialize() [function.serialize]: “xxx” returned as member variable from __sleep() but does not exist in …
While storing an entity from Doctrine2 in the session under a Symfony2 application I got this error:ErrorException:...

Symfony2 – ErrorException: Notice: serialize() [function.serialize]: “xxx” returned as member variable from __sleep() but does not exist in …
While storing an entity from Doctrine2 in the session under a Symfony2 application I got this error:ErrorException:...

Symfony2 – ErrorException: Notice: serialize() [function.serialize]: “xxx” returned as member variable from __sleep() but does not exist in …
While storing an entity from Doctrine2 in the session under a Symfony2 application I got this error:ErrorException:...

Doctrine ORM: Exception “Duplicate entry ‘2147483647’”
I was storing Facebook and Twitter profile IDs and I got this error: SQLSTATE: Integrity constraint...

  1. Hola,

    Una pregunta, a través de qué debo entrar a la carpeta phppgadmin? Es decir con la ayuda de la terminal? O simplemente de una vez por sistema de archivos? Es que si me meto así no encuentro las otras carpetas que dicen en el artículo ni mucho menos los script que debo editar.

    • No importa si entras por el terminal o por el explorador de archivos, en cualquier caso deberías ver lo mismo.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.