pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: linasvepstas@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14494: Regression - Null arrays are not queryable
Date: Fri, 13 Jan 2017 13:05:08 -0800
Message-ID: <20170113210508.maf45fqy4ygw6doa@alap3.anarazel.de> (raw)
In-Reply-To: <20170113183824.24286.84705@wrigleys.postgresql.org>
References: <20170113183824.24286.84705@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hi,

On 2017-01-13 18:38:24 +0000, linasvepstas@gmail.com wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      14494
> Logged by:          Linas Vepstas
> Email address:      linasvepstas@gmail.com
> PostgreSQL version: 9.6.1
> Operating system:   Debian unstable
> Description:        
> 
> Array handling appears to have regressed,

Regressed from what?  Because these don't look like they'd have changed
recently.

> test=> select * from foo where outgoing=null;
>  name | outgoing 
> ------+----------
> (0 rows)
> 
> unexpected: wanted one row here.

Comparisons with NULL result in NULL, which evaluates to false in a
WHERE clause.  Try WHERE outgoing IS NULL;


> test=> select * from foo where outgoing != '{43,67}';
>  name | outgoing 
> ------+----------
>  two  | {}
> (1 row)
> 
> unexpected: wanted two rows here. Where did the null row go?

Same answer as above. WHERE outgoing IS DISTINCT FROM ...;

> 
> test=> select * from foo where array_length(outgoing,1)=0 ;
>  name | outgoing 
> ------+----------
> (0 rows)
> 
> Huh? there is at least one array whose length is zero, 

An empty array doesn't have a dimension 1 and thus results in NULL. Yes,
that's a bit confusing.

> and another that doesn't have a length...

You mean the NULL one? Why would you expect a 0 as a result then?

Greetings,

Andres Freund


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



view thread (6+ messages)  latest in thread

Message-ID: <20170113210508.maf45fqy4ygw6doa@alap3.anarazel.de>
Permalink:  ../20170113210508.maf45fqy4ygw6doa@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20170113210508.maf45fqy4ygw6doa@alap3.anarazel.de

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andres@anarazel.de, linasvepstas@gmail.com
  Subject: Re: BUG #14494: Regression - Null arrays are not queryable
  In-Reply-To: <20170113210508.maf45fqy4ygw6doa@alap3.anarazel.de>
  References: <20170113183824.24286.84705@wrigleys.postgresql.org> <20170113210508.maf45fqy4ygw6doa@alap3.anarazel.de>

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

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