Thread: a problem with case in psql

a problem with case in psql

From
"Øystein Thorsen"
Date:
I've used pgAccess to make all the tables and colums.
Ex.: table diagnosis column diagnosis_ID

Then, when I use psql to execute select statements, diagnosis_ID does
not exist.

But when I change the column name to diagnosis_id it works fine.

The problem is therefore that it is possible to create a column name
with uppercase but psql transforms all statements to lowercase, and
therefore will not work.

(Sorry about my bad English)

Øystein Thorsen
Norwegian student

Re: a problem with case in psql

From
Stephan Szabo
Date:
On Wed, 3 Apr 2002, =D8ystein Thorsen wrote:

> I've used pgAccess to make all the tables and colums.
> Ex.: table diagnosis column diagnosis_ID
>
> Then, when I use psql to execute select statements, diagnosis_ID does
> not exist.
>
> But when I change the column name to diagnosis_id it works fine.
>
> The problem is therefore that it is possible to create a column name
> with uppercase but psql transforms all statements to lowercase, and
> therefore will not work.

It probably means that pgAccess is double quoting the identifier for you
on creation, in which case you should (and must if the identifier is
mixed case) always refer to it in double quotes.  If the identifier
wasn't double quoted at creation time it would have been case folded
to lowercase as well.