Re: impossible to update rows specifying columns with NULL

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: impossible to update rows specifying columns with NULL
Дата
Msg-id 422460E3.3040100@fastcrypt.com
обсуждение исходный текст
Ответ на Re: impossible to update rows specifying columns with NULL  (Oliver Jowett <oliver@opencloud.com>)
Ответы Re: impossible to update rows specifying columns with NULL  (Markus Schaber <schabios@logi-track.com>)
Список pgsql-jdbc
Well, if you are really intent on using this you can set
transform_null_equals=true in postgresql.conf

Dave

Oliver Jowett wrote:

> Guillaume Cottenceau wrote:
>
>> Oliver Jowett <oliver 'at' opencloud.com> writes:
>>
>>
>>> Guillaume Cottenceau wrote:
>>>
>>>
>>>> The problem is when trying to UPDATE (changing values of other
>>>> columns): my PreparedStatement uses "... WHERE column = ?" to
>>>> specify the NULL value for the said column,
>>>
>>>
>>> You can't do that and get the results you expect. "column = NULL" is
>>> never true (because "NULL = NULL" is false). You should use IS NULL to
>>> match a NULL value.
>>
>>
>> It's a pity. This would be very helpful.
>
>
> Unfortunately, that's just the way that SQL NULLs work..
>
>> With such situation, we
>> can't use the same prepared-statement to match NULL and non-NULL
>> values then, or I missed something?
>
>
> You are correct.
>
> -O
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if
> your
>      joining column's datatypes do not match
>
>

--
Dave Cramer
http://www.postgresintl.com
519 939 0336
ICQ#14675561


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: Connection pool problem
Следующее
От: Stéphane RIFF
Дата:
Сообщение: Re: Connection pool problem