Thread: BUG #8373: can create database with long name , but can't connect

BUG #8373: can create database with long name , but can't connect

From
gerrit.geurs@hp.com
Date:
The following bug has been logged on the website:

Bug reference:      8373
Logged by:          Gerrit Geurs
Email address:      gerrit.geurs@hp.com
PostgreSQL version: 9.2.4
Operating system:   RHEL 6.4
Description:

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.

Re: BUG #8373: can create database with long name , but can't connect

From
Pavan Deolasee
Date:
On Wed, Aug 7, 2013 at 8:14 PM, <gerrit.geurs@hp.com> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      8373
> Logged by:          Gerrit Geurs
> Email address:      gerrit.geurs@hp.com
> PostgreSQL version: 9.2.4
> Operating system:   RHEL 6.4
> Description:
>
> 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
>
>
You misspelled the database name. Please check.
vergunningen_sit - What you are connecting
vergunnigen_sit - What you created


Thanks,
Pavan
--
Pavan Deolasee
http://www.linkedin.com/in/pavandeolasee

Re: BUG #8373: can create database with long name , but can't connect

From
Alvaro Herrera
Date:
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