pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: thibaut.madelaine@dalibo.com
Subject: BUG #15669: Error with unnest in PG 11 (ERROR:  0A000)
Date: Tue, 05 Mar 2019 11:06:00 +0000
Message-ID: <15669-02fb3296cca26203@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      15669
Logged by:          Thibaut MADELAINE
Email address:      thibaut.madelaine@dalibo.com
PostgreSQL version: 11.2
Operating system:   Debian
Description:        

Hello,

A client found a possible bug in version 11.2.

Trying to use "unnest" on an array record with the predicate "false" fails
with the message:
ERROR:  set-valued function called in context that cannot accept a set

In PostgreSQL 10.7 and before, it is possible to run the following query:
==========
thibaut=# select version();
                                                      version               
                                      
-------------------------------------------------------------------------------------------------------------------
 PostgreSQL 10.7 (Debian 10.7-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled
by gcc (Debian 8.2.0-16) 8.2.0, 64-bit
(1 ligne)

thibaut=# WITH test AS ( SELECT array[1,2] AS intarr ) 
                 SELECT unnest(intarr) AS lot_id FROM test WHERE false;
 lot_id 
--------
(0 ligne)
==========

In version 11.2, the same query fails:
==========
thibaut=# select version();
                                                      version               
                                      
-------------------------------------------------------------------------------------------------------------------
 PostgreSQL 11.2 (Debian 11.2-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled
by gcc (Debian 8.2.0-16) 8.2.0, 64-bit
(1 ligne)

thibaut=#  \set VERBOSITY verbose
thibaut=# WITH test AS ( SELECT array[1,2] AS intarr ) 
                 SELECT unnest(intarr) AS lot_id FROM test WHERE false;
ERROR:  0A000: set-valued function called in context that cannot accept a
set
LIGNE 2 :  SELECT unnest(intarr) as lot_id FROM test where false;
                  ^
EMPLACEMENT : ExecInitFunc, execExpr.c : 2212
==========

The same query with a false predicate that needs to be evaluated succeeds:
==========
thibaut=# with test as ( SELECT array[1,2] as intarr )
 SELECT unnest(intarr) as lot_id FROM test where now()<'1996-01-01';
 lot_id 
--------
(0 ligne)
==========



view thread (18+ messages)  latest in thread

Message-ID: <15669-02fb3296cca26203@postgresql.org>
Permalink:  ../15669-02fb3296cca26203@postgresql.org/
Also on:    postgresql.org/message-id/15669-02fb3296cca26203@postgresql.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, thibaut.madelaine@dalibo.com
  Subject: Re: BUG #15669: Error with unnest in PG 11 (ERROR:  0A000)
  In-Reply-To: <15669-02fb3296cca26203@postgresql.org>

* 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