postgresql91-server install

Phillip Koebbe phillip.koebbe at gmail.com
Tue Jan 17 12:04:56 PST 2012


On Jan 17, 2012, at 12:25 PM, Érico wrote:

> Hi 
> 
> I am getting an error : 
> 
> bash-3.2$ psql -d postgres
> Welcome to psql 8.3.17 (server 9.1.2), the PostgreSQL interactive terminal.
> 
> Type:  \copyright for distribution terms
>        \h for help with SQL commands
>        \? for help with psql commands
>        \g or terminate with semicolon to execute query
>        \q to quit
> 
> WARNING:  You are connected to a server with major version 9.1,
> but your psql client is major version 8.3.  Some backslash commands,
> such as \d, might not work properly.
> 
> postgres=# create database test_db
> 
> all ok so far ... no errors
> 
> then 
> 
> postgres-# \c test_db
> FATAL:  database "test_db" does not exist
> Previous connection kept
> .....
> 
> postgres-# \c testdb
> FATAL:  database "testdb" does not exist
> Previous connection kept
> ….

psql requires SQL commands to be terminated with a semicolon. psql commands, such as \c and \l don't need semicolon terminators. It's hard to tell, but the prompt is actually different when you tried to connect to test_db. Notice the difference between

postgres=#

and

postgres-#

So you didn't actually create the database. Terminate with a semicolon and try again:

postgres=# create database test_db;
CREATE DATABASE
postgres=# \c test_db
You are now connected to database "test_db".
test_db=# 

Phillip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-users/attachments/20120117/9f7cb0e7/attachment.html>


More information about the macports-users mailing list