Search Postgresql Archives

Re: Column names getting lower-case in SELECT statements when issued via JDBC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 15 May 2011 21:04, Eduardas F. <tcpa252@xxxxxxxxx> wrote:
Hello everyone, today I encountered this nasty problem:
Whenever you issue an SELECT command from JDBC (prepared statement) you end up with column X does not exist. And column X name is shown inÂlower-case AsÂIÂunderstand,ÂPostgreSQL ServerÂorÂPostgreSQLÂJDBC driver converts column names containingÂupper-caseÂletters toÂlower-case? Is there an easy way to bypass thisÂbehaviour? (ChanningÂcolumn names is not an option).


Here's an example of crashing SELECT:Â"SELECT password, accessLevel, lastServer, userIP FROM accounts WHERE login=?"
You end up with 'column "accesslevel" does not exist'.

Thanks for help in advance.


Hi,
if you create a column using "accessLevel", then you have to access it using "accessLevel". If you omit all the quotation marks, then the name is stored as lowercase so you can access it using accessLevel or ACCESSLEVEL or accesslevel.

Let's try this query:
"SELECT \"password\",Â\"accessLevel\",Â\"lastServer\",Â\"userIP\"ÂFROM accounts WHERE login=?"

I don't think there is any way to change the default behavior.Â

regards
Szymon

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux