From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Michael Herold <quabla(at)hemio(dot)de> |
Cc: | pgsql-docs(at)postgresql(dot)org |
Subject: | Re: ARRAY[1] || NULL <> array_append(ARRAY[1], NULL) |
Date: | 2015-07-09 14:00:57 |
Message-ID: | 32402.1436450457@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
Michael Herold <quabla(at)hemio(dot)de> 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
From | Date | Subject | |
---|---|---|---|
Next Message | amul sul | 2015-07-10 09:20:11 | typo in synchronous_commit description |
Previous Message | Michael Herold | 2015-07-09 00:31:10 | ARRAY[1] || NULL <> array_append(ARRAY[1], NULL) |