BUG #17340: Unnest discards rows with empty or null arrays

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: magnus(dot)falch(at)gmail(dot)com
Subject: BUG #17340: Unnest discards rows with empty or null arrays
Date: 2021-12-20 10:38:28
Message-ID: 17340-74d17bbe94cb4190@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 17340
Logged by: Magnus Falch
Email address: magnus(dot)falch(at)gmail(dot)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

Responses

Browse pgsql-bugs by date

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