Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error on creating database in phppgadmin

I have PostgreSQL 9.2.0. On clicking create database it shows following error:

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

SELECT spcname, pg_catalog.pg_get_userbyid(spcowner) AS spcowner, spclocation,
       (SELECT description FROM pg_catalog.pg_shdescription pd WHERE pg_tablespace.oid=pd.objoid) AS spccomment
        FROM pg_catalog.pg_tablespace WHERE spcname NOT LIKE $$pg\_%$$ ORDER BY spcname
like image 910
Gagan Deep Avatar asked Nov 20 '12 06:11

Gagan Deep


People also ask

How do you create a database in pgadmin4?

Using a GUI Run pgAdmin. Right-click on the item Servers , select Create -> Server and provide the connection to your PostgreSQL instance set up in step 1. In the default PostgreSQL setup, the administrator user is postgres with an empty password. In the connection tab be sure to have the host set to localhost .

Which tool can you use to both design and create a Postgres database?

pgAdmin. pgAdmin is the de facto GUI tool for PostgreSQL, and the first tool anyone would use for PostgreSQL. It supports all PostgreSQL operations and features while being free and open source. pgAdmin is used by both novice and seasoned DBAs and developers for database administration.


3 Answers

Quick Fix: (worked with my Version (5.0.3) / pg 9.2.3 )

  1. change to /classes/database
  2. copy Postgres84.php to Postgres92.php
  3. open Connection.php
  4. add a line case '9.2': return 'Postgres92'; break; at the // Detect version and choose appropriate database driver switch.
  5. open Postgres.php and copy functions getTablespaces + getTablespace
  6. open Postgres92.php and paste the functions into the class
  7. replace ", spclocation," with ", pg_tablespace_location(oid) as spclocation," in both functions.

  8. in Postgres92.php change class name to Postgres92

like image 146
Aimagu Avatar answered Oct 05 '22 23:10

Aimagu


I updated to Mountain Lion on my Mac Mini Server on the evening of 12/12/2012 which runs PostgreSQL 9.2.1. I had the same problem when I found this question. When I did a search about this problem I found the following bug tracker on the matter.

http://sourceforge.net/tracker/?func=detail&aid=3570272&group_id=37132&atid=418980

One of the comments suggests to download the developer branch from github to get around this from https://github.com/phppgadmin/phppgadmin/zipball/master. I did this and copied the to /Library/Server/Web/Data/Sites/Default and renamed the folder. I modified $conf['servers'][0]['host'] to 127.0.0.1 in /conf/config.inc.php. I think I had to copy config.inc.php-dist. I have been successful in creating databases. As of 12/12 they had not released a stable version for 9.2. Hopefully they will soon.

like image 20
xxx Avatar answered Oct 05 '22 23:10

xxx


In short: table pg_tablespace does not have that column in 9.2.

It seems that information should be obtained from other means now, as mentioned in the mailing list.

Also notice how in the official phpPgAdmin page, the latest PostgreSQL supported version is 9.0.

like image 39
madth3 Avatar answered Oct 05 '22 22:10

madth3