Search Postgresql Archives

Re: operator varchar = integer

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

 



Hi,

Daniel Schuchardt wrote:
Tino Wildenhain schrieb:
Hi,

...
Comparing int with text in general does not sound like a very good
idea to me. It should be quite easy to write a script to identify
such places so you can either change the datatypes (preferred) or
add the cast. Then rerun your automated regression tests...

Cheers
T.
it is not possible to do this. we also used automatic casting as a feature:
if a user starts a search, we never check the data type he puts in. in 81 postgresql automatically casts the user input in dependece of the column. so all our search masks has to be checked to, edit fields need to get a data type and so on.

example:

user types 1  -> our application automatically starts a search "LIKE '1%'"
user types 12 -> our application automatically starts a search "LIKE '12%'"

and so on. and it doenst matter if the searchfield is char or integer, 81 does it automatically. if it is a good or bad thing to do it is another question. it works in 81 and so we used this feature.

hum. (yes still think there is a lot of improvement possible) but
you could either change the schema to use text instead of int
or easily identify the places where LIKE is used and cast the left hand
expression explicitely to text. When I think about it you should
actually know for sure which places they are since you probably created
functional indexes?

Also it sounds like you are assembling SQL for queries? In this case
its even more easy to put the casts in place (or change the column datatype). You mentioned support people - do they write raw SQL?

T.

<<attachment: smime.p7s>>


[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