public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Michael Herold <[email protected]>
Cc: [email protected]
Subject: Re: ARRAY[1] || NULL <> array_append(ARRAY[1], NULL)
Date: Thu, 09 Jul 2015 10:00:57 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgsql-docs>

Michael Herold <[email protected]> writes:
> A few minutes ago I got bitten by the following PostgreSQL (9.4) behavior
> SELECT ARRAY[1] || NULL, array_append(ARRAY[1], NULL);
>   ?column? | array_append
> ----------+--------------
>   {1}      | {1,NULL}

> I expected that array_append and || are equivalent in this case but 
> obviously they are not.

Yeah, the first case turns out to be array_cat not array_append.

> Sure, this is not too surprising since "||" has 
> to guess which operation is appropriate. However, I would have highly 
> appreciated ARRAY[1,2] || NULL as an example in [Table 9-45].

Hm.  I don't think there is really room for such an example in that table,
and certainly not room for a discursive discussion.  What would make more
sense to me is to add a paragraph and example concerning this issue at the
bottom of section 8.15.4, right after array_append and array_cat are
introduced.  Since there's already a pointer to 8.15 just below that
table, people would hopefully find the example from that vicinity as well.

Seem reasonable?

			regards, tom lane


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



view thread (7+ messages)  latest in thread

reply

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: ARRAY[1] || NULL <> array_append(ARRAY[1], NULL)
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox