Re: [GENERAL] different unnest function [SOLVED]

2011-09-18 Thread Ondrej Ivanič
Hi, > to get the output OP wants, you need to expand and rewrap: > create or replace function unnest2(anyarray) returns setof anyarray AS > $BODY$ > select array(select unnest($1[i:i])) from > generate_series(array_lower($1,1), array_upper($1,1)) i; > $BODY$ > language 'sql'; Yup, this is what I

Re: [GENERAL] different unnest function

2011-09-16 Thread Merlin Moncure
2011/9/16 David Johnston : > -Original Message- > From: pgsql-general-ow...@postgresql.org > [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Ondrej Ivanic > Sent: Friday, September 16, 2011 12:54 AM > To: pgsql-general@postgresql.org general > Subject: [GENERAL

Re: [GENERAL] different unnest function

2011-09-16 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Ondrej Ivanic Sent: Friday, September 16, 2011 12:54 AM To: pgsql-general@postgresql.org general Subject: [GENERAL] different unnest function Hi, I need function which

[GENERAL] different unnest function

2011-09-16 Thread Ondrej Ivanič
Hi, I need function which unnest array in a different way. Input table has ineger[][] column: col1 -- {{1,2,3,4}, {5,6,7,8}, {9, 10, 11, 12}} {{11,12,13,14}, {15,16,17,18}, {19, 110, 111, 112}} ... and output should be: select unnest2(col1) from T unnest2 - {1,2,3,4} {5,6