Re: concatenation operator || with "null" array

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: stroncococcus <stroncococcus(at)gmx(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: concatenation operator || with "null" array
Date: 2006-12-11 22:48:35
Message-ID: 200612112248.kBBMmZV04177@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


The question of concatentation using NULLs comes up enough that I have
added an item to an existing FAQ entry for it, patch attached.

---------------------------------------------------------------------------

stroncococcus wrote:
> Hello!
>
> When I try to fill an array with the concatenation operator, like
> UPDATE test SET myint = myint || ARRAY[123] WHERE id = 1
> that before that statement was null, then it is also null after that
> statement.
> But if there is already something in that array and I execute that
> statement, then everything works fine and one can find the 123 there,
> too.
> Is this the normal behavior? Is there a way to "concatenate" to null
> arrays as well, or do I have to test this inside my script, and if it
> is null fill it normal for the first time?
>
> Best regards,
> Kai
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
/rtmp/diff text/x-diff 3.6 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Davis 2006-12-11 23:00:43 Re: forcing compression of text field
Previous Message Magnus Hagander 2006-12-11 22:08:51 Re: tsearch2 and pdf files