Re: BUG #8373: can create database with long name , but can't connect - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: BUG #8373: can create database with long name , but can't connect
Date
Msg-id 20130807153552.GG10718@eldon.alvh.no-ip.org
Whole thread Raw
In response to BUG #8373: can create database with long name , but can't connect  (gerrit.geurs@hp.com)
List pgsql-bugs
gerrit.geurs@hp.com wrote:

> template1=# CREATE DATABASE vergunnigen_sit;
> CREATE DATABASE
> template1=# GRANT ALL PRIVILEGES ON DATABASE vergunnigen_sit to postgres;
> GRANT
> template1=# \q
> -bash-4.1$ psql vergunningen_sit
> psql: FATAL:  database "vergunningen_sit" does not exist
>
>
> When I do a \LIST, THE LONG NAME IS LISTED.

I think you have misdiagnosed the problem.  Maybe your psql is trying to
connect to another server, not the one on which you just created the
database.  It certainly works for me:

alvherre=# create database "you think that's a long database name, huh?";
CREATE DATABASE
alvherre=# \q

$ psql -d "you think that's a long database name, huh?"
psql (9.2.4)
Digite «help» para obtener ayuda.

you think that's a long database name, huh?=# select current_database();
-[ RECORD 1 ]----+--------------------------------------------
current_database | you think that's a long database name, huh?


You can use up to 63 bytes in a database name (or any other identifier,
for that matter).

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

pgsql-bugs by date:

Previous
From: Pavan Deolasee
Date:
Subject: Re: BUG #8373: can create database with long name , but can't connect
Next
From: Bruce Momjian
Date:
Subject: Re: BUG #8335: trim() un-document behaviour