Capitalized Databases and columns names

Capitalized Databases and columns names

am 12.01.2010 19:56:01 von Nadine Mauch

ref : PHP5 and postgresql 8.1

Hello,

For reasons of lisibility I've created DataBases and
Table Columns with capitalized names.

To access databases in php code I just use double
cotes as delimiters for names in sql requests.

I compose on-demand requests with concatened
php strings. The result is for example :
select "TCRtimestp" from "TrcDFCR" where "TCRtimestp"=20060228113419 ;

Such requests are manageable thru concatenation
but I get problems with functions like
select nextval ('TCRnrordre') ;
where the request becomes select nextval ('trcnrordre') ;
where everything is in lowercase and the result is :
relation tcrnrordre does not exist.
select nextval ('"TCRnrordre"') ; is not possible due
to syntax error.

I just don't achieve nor in php nor in psql to get the
next value because of this capitalize problem.
Does someone know if there is a solution or if
I have to use only lowercase caracters ?

Thanks.

Nadine



--
Sent via pgsql-php mailing list (pgsql-php@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-php

Re: Capitalized Databases and columns names

am 12.01.2010 20:39:21 von Guillaume Lelarge

Hi,

Le 12/01/2010 19:56, Nadine Mauch a =E9crit :
> [...]
> For reasons of lisibility I've created DataBases and
> Table Columns with capitalized names.
>=20
> To access databases in php code I just use double
> cotes as delimiters for names in sql requests.
>=20
> I compose on-demand requests with concatened
> php strings. The result is for example :
> select "TCRtimestp" from "TrcDFCR" where "TCRtimestp"=3D20060228113419 =
;
>=20
> Such requests are manageable thru concatenation
> but I get problems with functions like
> select nextval ('TCRnrordre') ;
> where the request becomes select nextval ('trcnrordre') ;
> where everything is in lowercase and the result is :
> relation tcrnrordre does not exist.
> select nextval ('"TCRnrordre"') ; is not possible due
> to syntax error.
>=20

It works for me.

b1=3D# create sequence "Titi";
CREATE SEQUENCE
b1=3D# select nextval('"Titi"');
nextval
---------
1
(1 ligne)

b1=3D# select nextval('"Titi"');
nextval
---------
2
(1 ligne)

Are you sure you gave us the right error message? can you copy and paste
it here?

> I just don't achieve nor in php nor in psql to get the
> next value because of this capitalize problem.
> Does someone know if there is a solution or if
> I have to use only lowercase caracters ?
>=20

You should better use lowercase for PostgreSQL objects, but your issue
is not related to this.

Regards.


--=20
Guillaume.
http://www.postgresql.fr
http://dalibo.com

--=20
Sent via pgsql-php mailing list (pgsql-php@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-php