Re: Inconsistent casting with literal vs parameter
От | Markus Schaber |
---|---|
Тема | Re: Inconsistent casting with literal vs parameter |
Дата | |
Msg-id | 43E9BB1B.2070207@logix-tt.com обсуждение исходный текст |
Ответ на | Re: Inconsistent casting with literal vs parameter (Matthew Bellew <matthew@bellew.net>) |
Список | pgsql-jdbc |
Hi, Matthew, Matthew Bellew wrote: > My last 2 cents on the whole topic. There is a fundamental design issue > here with deciding to handle the expression /column < > (value/literal/parameter typed or not)/ by converting the column to a > string. Obviously, with INSERT INTO the data values must be coerced to > the destination column type. In this case, while there is a > parsing/optimizing decision to be made, it should be made with a strong > bias to convert to the column type (and then handling any tricky > coercion failures or optimization issues). The problem is that you explicitly send the parameter as a String to the server, so it gets the bias to coerce the column to the string. However, you can always make shure the parameters are compared set correctly by explicityl casting them: SELECT * FROM floats WHERE x<(?::double precision); or SELECT * FROM floats WHERE x<CAST(? as double precision); AFAIR, the latter one is standards conforming, and such more likely to work on other databases. HTH, Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org
В списке pgsql-jdbc по дате отправления: