Re: BUG #6295: Update fails on empty concatenated strings

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #6295: Update fails on empty concatenated strings
Дата
Msg-id 23407.1321457853@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #6295: Update fails on empty concatenated strings  ("Jonas Forsman" <jfo123@hotmail.com>)
Ответы Re: BUG #6295: Update fails on empty concatenated strings  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
"Jonas Forsman" <jfo123@hotmail.com> writes:
> sql:
> UPDATE user SET comment= E'[2011-11-16] Note to myself no: 171\\n' ||
> comment WHERE userid=1

> This query fails if comment is an empty string or null.

Define "fails".

Personally I'm wondering whether you remembered that concatenation of a
null with something else yields null.  You might possibly want to spell
the above as SET comment = '...' || coalesce(comment, null) ..., if you
want to pretend that a null is the same thing as an empty string.

            regards, tom lane

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

Предыдущее
От: "Jonas Forsman"
Дата:
Сообщение: BUG #6295: Update fails on empty concatenated strings
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #6295: Update fails on empty concatenated strings