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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jonas Forsman" <jfo123(at)hotmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6295: Update fails on empty concatenated strings
Date: 2011-11-16 15:37:33
Message-ID: 23407.1321457853@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Jonas Forsman" <jfo123(at)hotmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2011-11-16 15:44:38 Re: BUG #6295: Update fails on empty concatenated strings
Previous Message Maksym Boguk 2011-11-16 09:07:55 BUG #6296: High level backend-write activity on db