Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cS92q-0004cS-F0 for pgsql-bugs@arkaria.postgresql.org; Fri, 13 Jan 2017 21:05:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cS92p-0003Kc-VC for pgsql-bugs@arkaria.postgresql.org; Fri, 13 Jan 2017 21:05:56 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cS92A-0002Yj-RW for pgsql-bugs@postgresql.org; Fri, 13 Jan 2017 21:05:15 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cS928-0008Oj-6G for pgsql-bugs@postgresql.org; Fri, 13 Jan 2017 21:05:13 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 3B57E20C1B; Fri, 13 Jan 2017 16:05:10 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Fri, 13 Jan 2017 16:05:10 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=eQirOBZptFSgk2 LXABDXRVg6D7U=; b=lgxnyX5TlcfOZEXX0pZaGgxXUo4aeqti1dyrh+CUaWnE+u T5cxWCH9csuk/tdkD6pM3oM0JrJaqGZuPWdVDtPbdl+dwuZX/ahCXaWXjX/dTbUj HZMcew75IjewYsheKjSTNbd3JiyH5ti08kzubI2jBIVbEjmKjPaSzRI+B0AWQ= X-ME-Sender: X-Sasl-enc: pNSp6zpDezJicEsgirvJm96nhnPl7CxDVa7wEr7MV4ON 1484341509 Received: from intern.anarazel.de (unknown [199.87.86.247]) by mail.messagingengine.com (Postfix) with ESMTPA id E56927E2B5; Fri, 13 Jan 2017 16:05:09 -0500 (EST) Date: Fri, 13 Jan 2017 13:05:08 -0800 From: Andres Freund To: linasvepstas@gmail.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14494: Regression - Null arrays are not queryable Message-ID: <20170113210508.maf45fqy4ygw6doa@alap3.anarazel.de> References: <20170113183824.24286.84705@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170113183824.24286.84705@wrigleys.postgresql.org> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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