pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
NULL handling in 1D array comparison
2+ messages / 2 participants
[nested] [flat]

* NULL handling in 1D array comparison
@ 2021-05-04 16:35  Manvendra <manvendra2525@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Manvendra @ 2021-05-04 16:35 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

postgres=# select version();
                                                             version
---------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 13.0 (Ubuntu 13.0-1.pgdg18.04+1) on x86_64-pc-linux-gnu,
compiled by gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, 64-bit
(1 row)

Comparison should return UNKNOWN but it's returning a true.

postgres=# select array[null]=array[null];
 ?column?
----------
 t
(1 row)

postgres=# select array[1, null]=array[1, null];
 ?column?
----------
 t
(1 row)

SQL-99 standard use to say it should come out as UNKNOWN
https://crate.io/docs/sql-99/en/latest/chapters/10.html#comparison

Thanks & Regards,
Manvendra Panwar
Email - manvendra2525@gmail.com

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: NULL handling in 1D array comparison
@ 2021-05-04 16:53  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Manvendra <manvendra2525@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2021-05-04 16:53 UTC (permalink / raw)
  To: Manvendra <manvendra2525@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org

Manvendra <manvendra2525@gmail.com> writes:
> Comparison should return UNKNOWN but it's returning a true.

> postgres=# select array[null]=array[null];

Yeah, that's intentional, because we have to be able to sort arrays.
Comparison of composites behaves similarly, btw.

> SQL-99 standard use to say it should come out as UNKNOWN

We're going to politely ignore the spec on this.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-05-04 16:53 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 16:35 NULL handling in 1D array comparison Manvendra <manvendra2525@gmail.com>
2021-05-04 16:53 ` Tom Lane <tgl@sss.pgh.pa.us>

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