From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: posuch@gmail.com
Subject: BUG #16959: Unnesting null from string_to_array silently removes whole rows from result
Date: Sun, 11 Apr 2021 23:50:01 +0000
Message-ID: <16959-4c11c2e812e2b52c@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 16959
Logged by: Pete O'Such
Email address: posuch@gmail.com
PostgreSQL version: 11.7
Operating system: Ubuntu (and also Red Hat)
Description:
Applying unnest() to the output of string_to_array() operating on a null
silently drops the entire row from the query results. I'm agnostic
regarding what would be a proper resulting value within the column, but the
silent omission of the whole row from the result is a problem to me.
Sample data:
create table test_rows as
SELECT * FROM (VALUES (1, null), (2, 'second')) AS t (num,letter);
SELECT 2
Query with the unexpected result (I expected 2 rows):
select num, unnest(string_to_array(letter, ',')) from test_rows;
num | unnest
----+--------
2 | second
(1 row)
Correct or expected behavior from a similar operation:
select num, unnest(array[letter]) from test_rows;
num | unnest
----+--------
1 |
2 | second
(2 rows)
Thanks,
Pete O'Such
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, posuch@gmail.com
Subject: Re: BUG #16959: Unnesting null from string_to_array silently removes whole rows from result
In-Reply-To: <16959-4c11c2e812e2b52c@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