Re: select NULL||'abc' returns empty string (or NULL) - Mailing list pgsql-general

From Alexey Borzov
Subject Re: select NULL||'abc' returns empty string (or NULL)
Date
Msg-id 17476118372.20020227145653@rdw.ru
Whole thread Raw
In response to select NULL||'abc' returns empty string (or NULL)  (Holger Marzen <holger@marzen.de>)
List pgsql-general
Greetings, Holger!

At 27.02.2002, 14:25, you wrote:
HM> I suppose that PostgreSQL insists that a NULL value cannot be
HM> concatenated with a string. Can I cast this somehow? I noticed that
HM> feature when I did a

HM> select * from tab where col1||col2 ilike '%bla%'

HM> and it did't find rows where one of the columns was NULL. Any ideas for
HM> workarounds?
    Yes:
    SELECT * FROM tab WHERE coalesce(col1, '')||coalesce(col2, '') ILIKE '%bla%';

--
Yours, Alexey V. Borzov, Webmaster of RDW.ru



pgsql-general by date:

Previous
From: Holger Marzen
Date:
Subject: select NULL||'abc' returns empty string (or NULL)
Next
From: Martijn van Oosterhout
Date:
Subject: Re: select NULL||'abc' returns empty string (or NULL)