BUG #17340: Unnest discards rows with empty or null arrays - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #17340: Unnest discards rows with empty or null arrays
Date
Msg-id 17340-74d17bbe94cb4190@postgresql.org
Whole thread Raw
List pgsql-bugs
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


pgsql-bugs by date:

Previous
From: Yura Sokolov
Date:
Subject: Re: BUG #17335: Duplicate result rows in Gather node when "Suppress Append ... that have a single child" applied
Next
From: Michael Paquier
Date:
Subject: Re: BUG #17339: Assert failed on attempt to detach a sequence concurrently