Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TDh3Y-0006Sp-G6 for pgsql-bugs@postgresql.org; Mon, 17 Sep 2012 19:32:32 +0000 Received: from mahout.postgresql.org ([98.129.198.123]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TDh3X-0004Fa-5P for pgsql-bugs@postgresql.org; Mon, 17 Sep 2012 19:32:31 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TDh3W-000304-TD for pgsql-bugs@postgresql.org; Mon, 17 Sep 2012 19:32:31 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1TDh3W-0004tQ-F9 for pgsql-bugs@postgresql.org; Mon, 17 Sep 2012 19:32:30 +0000 Date: Mon, 17 Sep 2012 19:32:30 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #7550: NULL result when coercing a subquery result into an array To: pgsql-bugs@postgresql.org From: tom@tomforb.es X-Pg-Spam-Score: -2.4 (--) X-Archive-Number: 201209/171 X-Sequence-Number: 34166 The following bug has been logged on the website: Bug reference: 7550 Logged by: Tom Forbes Email address: tom@tomforb.es PostgreSQL version: 9.2.0 Operating system: Windows 8 Description: = Hello, I wasn't sure how to title this report so apologies if it is incorrect or misleading. I have two queries: http://pgsql.privatepaste.com/7d1473defa http://pgsql.privatepaste.com/85e1d43b7a The first query returns NULL and the second one returns an int[] with 623 elements in it. The only difference between the two queries is the last string - 'J. P. Bickella' returns NULL and 'J. P. Bickell' returns an int[]. The base query with no values can be found here: http://pgsql.privatepaste.com/1ebe2d7646 And the EXPLAIN ANALYZE VERBOSE of the queries can be found here: http://pgsql.privatepaste.com/a4b8b622c5 <-- Returns int[] http://pgsql.privatepaste.com/525fda6340 <-- Returns NULL In summary: Changing the last (or second to last) element of the second IN clause causes the query to return an array as expected, whereas setting it to 'J. P. Bickella' causes it to return NULL. Executing the query without wrapping it in an array() returns the expected results. If needed I can host the database this query is executing on for people to download upon request, but it is 1.2gb in size.