From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | Alban Hertroys <haramrae(at)gmail(dot)com>, Alexander Farber <alexander(dot)farber(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: select array_remove(ARRAY[NULL,NULL,NULL],NULL); returns {} instead of {NULL,NULL,NULL} |
Date: | 2016-08-08 23:18:13 |
Message-ID: | 25549.1470698293@sss.pgh.pa.us |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Mon, Aug 8, 2016 at 5:51 PM, Alban Hertroys <haramrae(at)gmail(dot)com> wrote:
>> How does it now which unknown value to remove from that array of unknown
>> values? Shouldn't the result be:
>> {NULL,NULL,NULL}?
> Is this a philosophical or technical question?
> For the former I don't see why one would choose to define this function in
> any other way. If you accept that the searching value can be NULL then it
> follows that you must compare two NULLs as equal.
Strictly speaking, array_remove (and I think array_replace as well)
implements "IS NOT DISTINCT FROM" semantics rather than "=" semantics.
I dunno that we want to make the documentation use that wording though,
it'd probably confuse more people than it helped.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Xtra Coder | 2016-08-09 00:25:40 | Any reasons for 'DO' statement not returning result? |
Previous Message | Craig Boucher | 2016-08-08 22:59:50 | Re: Column order in multi column primary key |