| От | Tom Lane |
|---|---|
| Тема | Re: Bug #604: string join problem |
| Дата | |
| Msg-id | 29880.1014737706@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Bug #604: string join problem (pgsql-bugs@postgresql.org) |
| Список | pgsql-bugs |
pgsql-bugs@postgresql.org writes:
> I have a major problem with string joining in sql query in Postgresql 7.1.3. It is always return null string if any
ofcolumn has null value.
This is not a bug. SQL92 6.13 general rule 2a saith:
a) If either S1 or S2 is the null value, then the result of the
<concatenation> is the null value.
Consider using something like
COALESCE(col1,'') || COALESCE(col2,'') || ...
if you want to treat NULLs as empty strings. Also consider whether you
shouldn't have stored the fields as empty strings in the first place.
NULL and empty string are not at all the same thing; if your data design
treats them as interchangeable then your design is broken, IMHO.
regards, tom lane
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера