Re: select NULL||'abc' returns empty string (or NULL)

From: Alexey Borzov <borz_off(at)rdw(dot)ru>
To: Holger Marzen <holger(at)marzen(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: select NULL||'abc' returns empty string (or NULL)
Date: 2002-02-27 11:56:53
Message-ID: 17476118372.20020227145653@rdw.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2002-02-27 12:00:20 Re: select NULL||'abc' returns empty string (or NULL)
Previous Message Holger Marzen 2002-02-27 11:25:54 select NULL||'abc' returns empty string (or NULL)