pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14717: NULL=NULL is true for composite types
3+ messages / 3 participants
[nested] [flat]

* BUG #14717: NULL=NULL is true for composite types
@ 2017-06-26 15:29  paolo.guagliardo@ed.ac.uk
  0 siblings, 1 reply; 3+ messages in thread

From: paolo.guagliardo@ed.ac.uk @ 2017-06-26 15:29 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      14717
Logged by:          Paolo Guagliardo
Email address:      paolo.guagliardo@ed.ac.uk
PostgreSQL version: 9.6.3
Operating system:   Scientific Linux release 7.3 (Nitrogen)
Description:        

Comparisons between row types with NULLs behave as expected:

SELECT (1,NULL) = (1,NULL);

 ?column? 
----------
 
(1 row)

However, if we now create a composite type:

CREATE TYPE pair AS (a int, b int);

then we get

SELECT (1,NULL)::pair = (1,NULL)::pair ;

 ?column? 
----------
 t
(1 row)

while the answer should be NULL (unknown) as before.

Other operations (<>,>,<,>=,<=) are affected as well.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


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

* Re: BUG #14717: NULL=NULL is true for composite types
@ 2017-06-26 15:49  David G. Johnston <david.g.johnston@gmail.com>
  parent: paolo.guagliardo@ed.ac.uk
  0 siblings, 1 reply; 3+ messages in thread

From: David G. Johnston @ 2017-06-26 15:49 UTC (permalink / raw)
  To: paolo.guagliardo@ed.ac.uk; +Cc: pgsql-bugs

On Mon, Jun 26, 2017 at 8:29 AM, <paolo.guagliardo@ed.ac.uk> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      14717
> Logged by:          Paolo Guagliardo
> Email address:      paolo.guagliardo@ed.ac.uk
> PostgreSQL version: 9.6.3
> Operating system:   Scientific Linux release 7.3 (Nitrogen)
> Description:
>
> ​[...]
​


> SELECT (1,NULL)::pair = (1,NULL)::pair ;
>
>  ?column?
> ----------
>  t
> (1 row)
>
> while the answer should be NULL (unknown) as before.
>

Working as documented.

https://www.postgresql.org/docs/9.6/static/functions-comparisons.html

See the last two sections for why (or at least how...) "anonymous row
constructor" and "named record" are treated differently.

David J.

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

* Re: BUG #14717: NULL=NULL is true for composite types
@ 2017-06-26 15:53  Paolo Guagliardo <paolo.guagliardo@ed.ac.uk>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Paolo Guagliardo @ 2017-06-26 15:53 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-bugs

I'm really sorry, David. For some reason I overlooked that part. Thanks.

⁣Sent from BlueMail ​On Jun 26, 2017, at 4:49 PM, "David G. Johnston" <david.g.johnston@gmail.com> wrote:

On Mon, Jun 26, 2017 at 8:29 AM, <paolo.guagliardo@ed.ac.uk> wrote:

The following bug has been logged on the website:

Bug reference:      14717
Logged by:          Paolo Guagliardo
Email address:      paolo.guagliardo@ed.ac.uk
PostgreSQL version: 9.6.3
Operating system:   Scientific Linux release 7.3 (Nitrogen)
Description:

​[...]​ 

SELECT (1,NULL)::pair = (1,NULL)::pair ;

 ?column?
----------
 t
(1 row)

while the answer should be NULL (unknown) as before.


Working as documented.
https://www.postgresql.org/docs/9.6/static/functions-comparisons.html

See the last two sections for why (or at least how...) "anonymous row constructor" and "named record" are treated differently.
David J.

On Jun 26, 2017, 4:49 PM, at 4:49 PM, "David G. Johnston" <david.g.johnston@gmail.com> wrote:
>On Mon, Jun 26, 2017 at 8:29 AM, <paolo.guagliardo@ed.ac.uk> wrote:
>
>> The following bug has been logged on the website:
>>
>> Bug reference:      14717
>> Logged by:          Paolo Guagliardo
>> Email address:      paolo.guagliardo@ed.ac.uk
>> PostgreSQL version: 9.6.3
>> Operating system:   Scientific Linux release 7.3 (Nitrogen)
>> Description:
>>
>> ​[...]
>​
>
>
>> SELECT (1,NULL)::pair = (1,NULL)::pair ;
>>
>>  ?column?
>> ----------
>>  t
>> (1 row)
>>
>> while the answer should be NULL (unknown) as before.
>>
>
>Working as documented.
>
>https://www.postgresql.org/docs/9.6/static/functions-comparisons.html
>
>See the last two sections for why (or at least how...) "anonymous row
>constructor" and "named record" are treated differently.
>
>David J.
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

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


end of thread, other threads:[~2017-06-26 15:53 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-06-26 15:29 BUG #14717: NULL=NULL is true for composite types paolo.guagliardo@ed.ac.uk
2017-06-26 15:49 ` David G. Johnston <david.g.johnston@gmail.com>
2017-06-26 15:53   ` Paolo Guagliardo <paolo.guagliardo@ed.ac.uk>

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