From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jonas Forsman <jfo123@hotmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6295: Update fails on empty concatenated strings
Date: Wed, 16 Nov 2011 10:37:33 -0500
Message-ID: <23407.1321457853@sss.pgh.pa.us> (raw)
In-Reply-To: <201111160847.pAG8lCdx067272@wwwmaster.postgresql.org>
References: <201111160847.pAG8lCdx067272@wwwmaster.postgresql.org>
"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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, jfo123@hotmail.com
Subject: Re: BUG #6295: Update fails on empty concatenated strings
In-Reply-To: <23407.1321457853@sss.pgh.pa.us>
References: <201111160847.pAG8lCdx067272@wwwmaster.postgresql.org> <23407.1321457853@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox