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: magnus.falch@gmail.com
Subject: BUG #17340: Unnest discards rows with empty or null arrays
Date: Mon, 20 Dec 2021 10:38:28 +0000
Message-ID: <17340-74d17bbe94cb4190@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      17340
Logged by:          Magnus Falch
Email address:      magnus.falch@gmail.com
PostgreSQL version: 14.1
Operating system:   Ubuntu 20.04
Description:        

No part of the documentation covers this behaviour and it feels incorrect.

A function called in the select part of a query discarding other data does
not make sense and feels like it breaks with expectations without being
documented.

select name,unnest(test_values.int_array) as array_item from
(select 'test_a' as name,null :: int[] as int_array union all
select 'test_b' as name ,array[1,2,3] as int_array ) test_values

Actual result set:
name |    array_item
test_b |    1
test_b |    2
test_b |    3 


Expected result set:
name |    array_item
test_a |    null
test_b |    1
test_b |    2
test_b |    3



view thread (5+ messages)  latest in thread

Message-ID: <17340-74d17bbe94cb4190@postgresql.org>
Permalink:  ../17340-74d17bbe94cb4190@postgresql.org/
Also on:    postgresql.org/message-id/17340-74d17bbe94cb4190@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, magnus.falch@gmail.com
  Subject: Re: BUG #17340: Unnest discards rows with empty or null arrays
  In-Reply-To: <17340-74d17bbe94cb4190@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