select unnest(), unnest()

Jasmin Dizdarevic <[email protected]>
Newsgroups gmane.comp.db.postgresql.sql
Message-ID <CAOveQuP6xqLzopbp+pMp8sbbSvKwHj2z6BXM_jEq9onqXwo+uQ@mail.gmail.com>
Hi, we have some queries that use unnest() function.

create table configuration (

id int,

advisor text,

branch text,

primary key(id)

);

insert into configuration values

(1,'a','00,01'),

(2,'a','00'),

(3,'b','02,03'),

(4,'c','05'),

(5,'d,e','00,01');

select id, unnest(string_to_array(advisor,',')), unnest
(string_to_array(branch,','))

from configuration;


PG9.6:

id | unnest | unnest

----+--------+--------

  1 | a      | 00

  1 | a      | 01

  2 | a      | 00

  3 | b      | 02

  3 | b      | 03

  4 | c      | 05

  5 | d      | 00

  5 | e      | 01

PG10:

id | unnest | unnest

----+--------+--------

  1 | a      | 00

  1 |        | 01

  2 | a      | 00

  3 | b      | 02

  3 |        | 03

  4 | c      | 05

  5 | d      | 00

  5 | e      | 01


- Is this wanted in PG10 or a bug?
- Is there a way to change the behaviour of pgsql to produce output like
9.6?
- A smooth sql-workaround?

Thank you very much!

Regards, Jasmin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.