case sensitive db name?

Started by Thomas Finneidabout 17 years ago2 messagesgeneral
Jump to latest
#1Thomas Finneid
tfinneid@fcon.no

I have a case sensitivity problem I dont understand.

On a Solaris 10 with pg 8.2.6 (Sun build) I get problems when I do a
CREATE DATABASE with a db name with case.

On a Kubuntu machine with pg 8.2.7 it is not a problem.

More specifically the problem arises after the CREATE DATABASE, it
occurs when I try to connect to the newly created database.

The script is as follows, execute with the command

$ psql -U postgres -f create_db.sql

# create_db.sql script start

\c postgres

create database Test1;
... create user etc...

\c Test1 user1

....
#Script end

at the connect command the script fails.
when I list the databases, it shows the db name with small letters,
as in: "test1" instead of "Test1"

Why is this a problem on one installation but not another?
and how can I fix the solaris installation?

regards

thomas

#2Richard Huxton
dev@archonet.com
In reply to: Thomas Finneid (#1)
Re: case sensitive db name?

Thomas Finneid wrote:

I have a case sensitivity problem I dont understand.

On a Solaris 10 with pg 8.2.6 (Sun build) I get problems when I do a
CREATE DATABASE with a db name with case.

On a Kubuntu machine with pg 8.2.7 it is not a problem.

More specifically the problem arises after the CREATE DATABASE, it
occurs when I try to connect to the newly created database.

You are creating one database with its name quoted, or accessing it that
way. PostgreSQL folds identifiers to lower-case unless you quote them,
in which case it leaves them alone.

CREATE DATABASE Test1 => test1
CREATE DATABASE TEST1 => test1
CREATE DATABASE "Test1" => Test1

Oh - most recent 8.2 is 8.2.11. too.

--
Richard Huxton
Archonet Ltd