   List of databases
  Database  |  Owner   
------------+----------
 Newnham    | prlw1

% psql Newnham
psql: connection to database "newnham" failed - FATAL 1:  Database "newnham" does not exist in the system catalog.

template1=> \c 'Newnham'
FATAL 1:  Database "newnham" does not exist in the system catalog.
Previous connection kept


How can I connect to a database with a variable case name?

Cheers,

Patrick

Thu, 20 Jan 2000 15:12:57 +0000
Patrick Welche <prlw1@newn.cam.ac.uk>
Variable case database names
There is some code in libpq which converts all database names to
lower-case, unless it's double quoted. That seems a little ill-conceived
to me, since you'd actually have to pass it something like
PGconnectdb("dbname=\"Newnham\"");

If anything, this would make it inconvenient it psql, because you'd have
to write
\c '"Newnham"'
since
\c "Newnham"
is interpreted differently.

Does anyone have an explanation for this? Why not leave the name as is?



On 2000-01-20, Patrick Welche mentioned:

>    List of databases
>   Database  |  Owner   
> ------------+----------
>  Newnham    | prlw1
> 
> % psql Newnham
> psql: connection to database "newnham" failed - FATAL 1:  Database "newnham" does not exist in the system catalog.
> 
> template1=> \c 'Newnham'
> FATAL 1:  Database "newnham" does not exist in the system catalog.
> Previous connection kept
> 
> 
> How can I connect to a database with a variable case name?
> 
> Cheers,
> 
> Patrick
> 
> ************
> 
> 

-- 
Peter Eisentraut                  Sernanders vï¿½g 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



Thu, 20 Jan 2000 22:55:11 +0100 (CET)
Peter Eisentraut <peter_e@gmx.net>
Re: [GENERAL] Variable case database names
[Charset ISO-8859-1 unsupported, filtering to ASCII...]
> There is some code in libpq which converts all database names to
> lower-case, unless it's double quoted. That seems a little ill-conceived
> to me, since you'd actually have to pass it something like
> PGconnectdb("dbname=\"Newnham\"");
> 
> If anything, this would make it inconvenient it psql, because you'd have
> to write
> \c '"Newnham"'
> since
> \c "Newnham"
> is interpreted differently.
> 
> Does anyone have an explanation for this? Why not leave the name as is?

We do the same thing with queries, right?  We force identifiers to lower
case unless quoted.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Thu, 20 Jan 2000 17:04:45 -0500 (EST)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: [HACKERS] Re: [GENERAL] Variable case database names
Peter Eisentraut <peter_e@gmx.net> writes:
> There is some code in libpq which converts all database names to
> lower-case, unless it's double quoted. That seems a little ill-conceived
> to me,

I think you are probably right.  The backend might try to lowercase the
name when it gets it, but it seems like libpq shouldn't be doing so
(any more than it's responsible for downcasing identifiers used in
SQL commands).

If the backend *does* lowercase the DB name used in a connect command,
is there any way to use a mixed-case DB name?  I'm not sure there is...

			regards, tom lane

Thu, 20 Jan 2000 17:51:43 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Re: [GENERAL] Variable case database names 
On Thu, Jan 20, 2000 at 05:04:45PM -0500, Bruce Momjian wrote:
> [Charset ISO-8859-1 unsupported, filtering to ASCII...]
> > There is some code in libpq which converts all database names to
> > lower-case, unless it's double quoted. That seems a little ill-conceived
> > to me, since you'd actually have to pass it something like
> > PGconnectdb("dbname=\"Newnham\"");
> > 
> > If anything, this would make it inconvenient it psql, because you'd have
> > to write
> > \c '"Newnham"'
> > since
> > \c "Newnham"
> > is interpreted differently.
> > 
> > Does anyone have an explanation for this? Why not leave the name as is?
> 
> We do the same thing with queries, right?  We force identifiers to lower
> case unless quoted.

The point was: the database name was quoted. I didn't think to quote it
a second time. (single quoting for the create was sufficient, and the export
from access didn't mind about the case)

Cheers,

Patrick

Fri, 21 Jan 2000 19:06:59 +0000
Patrick Welche <prlw1@newn.cam.ac.uk>
Re: [HACKERS] Re: [GENERAL] Variable case database names
On 2000-01-20, Tom Lane mentioned:

> Peter Eisentraut <peter_e@gmx.net> writes:
> > There is some code in libpq which converts all database names to
> > lower-case, unless it's double quoted. That seems a little ill-conceived
> > to me,
> 
> I think you are probably right.  The backend might try to lowercase the
> name when it gets it, but it seems like libpq shouldn't be doing so
> (any more than it's responsible for downcasing identifiers used in
> SQL commands).
> 
> If the backend *does* lowercase the DB name used in a connect command,
> is there any way to use a mixed-case DB name?  I'm not sure there is...

The backend doesn't lower case it. I removed that part in libpq and now
it works fine.

-- 
Peter Eisentraut                  Sernanders vï¿½g 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



Sun, 23 Jan 2000 02:30:07 +0100 (CET)
Peter Eisentraut <peter_e@gmx.net>
Re: [HACKERS] Re: [GENERAL] Variable case database names 