case sensitivity

Started by Simon Crutealmost 25 years ago5 messagesgeneral
Jump to latest
#1Simon Crute
simon-news@nospam.geordie.demon.co.uk

Hi all,

I'm having some problems converting a CGI app from oracle to postgres (it
uses Perl & DBI)

When using sth->fetchrow_hashref() against the Oracle DBD, the keys are all
in upper case.

When using sth->fetchrow_hashref() against the Postgres DBD, the keys are
all in lower case.

Now, I'm not sure if oracle converts all column names to upper case, or if
postgres doesn't and "should", but I need to know if there's an easy way to
persuade the postgres DBD driver to return the names in upper case.

As separate point, postgres seems to be bothered about case a lot more than
oracle. My DBA spent ages looking at why a query using count didn't work.
Took a non DBA like me to suggest trying upper case :)

Is there anyway of "relaxing" postgres's demands to exact case, or is this
by design ?

Thanks.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Simon Crute (#1)
Re: case sensitivity

"Simon Crute" <simon-news@nospam.geordie.demon.co.uk> writes:

As separate point, postgres seems to be bothered about case a lot more than
oracle.

AFAIK we're exactly as picky about it as Oracle, just in the opposite
direction.

regards, tom lane

#3Simon Crute
simon-news@nospam.geordie.demon.co.uk
In reply to: Tom Lane (#2)
Re: case sensitivity

If anyone's interested,
I found the answer to my first question buried in the DBI docs
(fetch_hashref("NAME_uc") if anyone's interested)

With regards to case

AFAIK we're exactly as picky about it as Oracle, just in the opposite
direction.

I think there's some differences in function names. In oracle I think you
can get away with count(), or COUNT(), in postgres it has to be COUNT(), but
this was probably going through the perl DBI, so that may have been
complicating things.

#4Noname
newsreader@mediaone.net
In reply to: Simon Crute (#3)
Re: Re: case sensitivity

On Sun, May 13, 2001 at 11:21:20AM +0100, Simon Crute wrote:

If anyone's interested,
can get away with count(), or COUNT(), in postgres it has to be COUNT(), but
this was probably going through the perl DBI, so that may have been

been using count() since the
beginning of time

#5Gilles Darold
gilles@darold.net
In reply to: Tom Lane (#2)
Re: Re: case sensitivity

Simon Crute wrote:

If anyone's interested,
I found the answer to my first question buried in the DBI docs
(fetch_hashref("NAME_uc") if anyone's interested)

With regards to case

AFAIK we're exactly as picky about it as Oracle, just in the opposite
direction.

I think there's some differences in function names. In oracle I think you
can get away with count(), or COUNT(), in postgres it has to be COUNT(), but
this was probably going through the perl DBI, so that may have been
complicating things.

Oracle doesn't care about case sensitive in queries, Postgres too if you don't
quote tablename or columnname at creation time. If you use quote and upercase
at creation time you may quote it as well in you're queries. Function can be
lower
or upper case it doesn't matter at least in PostgreSQL 7.0.3.

SELECT COUNT(*) FROM "T_USERPREF";
select count(*) from "T_USERPREF";

Works well.

But you want columname returned as uppercase and you find the way...