pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Capitalized Databases and columns names
2+ messages / 2 participants
[nested] [flat]

* Capitalized Databases and columns names
@ 2010-01-12 18:56  Nadine Mauch <nadine.mauch@laposte.net>
  0 siblings, 1 reply; 2+ messages in thread

From: Nadine Mauch @ 2010-01-12 18:56 UTC (permalink / raw)
  To: pgsql-php


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





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Capitalized Databases and columns names
@ 2010-01-12 19:39  Guillaume Lelarge <guillaume@lelarge.info>
  parent: Nadine Mauch <nadine.mauch@laposte.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Guillaume Lelarge @ 2010-01-12 19:39 UTC (permalink / raw)
  To: Nadine Mauch <nadine.mauch@laposte.net>; +Cc: pgsql-php

Hi,

Le 12/01/2010 19:56, Nadine Mauch a écrit :
> [...]
> 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.
> 

It works for me.

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

b1=# 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 ?
> 

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

Regards.


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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2010-01-12 19:39 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-01-12 18:56 Capitalized Databases and columns names Nadine Mauch <nadine.mauch@laposte.net>
2010-01-12 19:39 ` Guillaume Lelarge <guillaume@lelarge.info>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox