Re: Splitting text column to multiple rows

From: "Andrus" <kobruleht2(at)hot(dot)ee>
To: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Splitting text column to multiple rows
Date: 2010-03-29 14:27:17
Message-ID: AFBFB7C89DF44964AB4439B685E92DB1@andrusnotebook
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Pavel,

> CREATE OR REPLACE FUNCTION unnest(anyarray)
> RETURNS SETOF anyelement as $$
> SELECT $1[i] FROM generate_series(1,4) g(i)
> $$ LANGUAGE sql;
>
> pavel(at)postgres:5481=# select unnest(string_to_array('23,2,3,4,5',','));
> unnest
> --------
> 23
> 2
> 3
> 4
> (4 rows)

Result is wrong: it must contain 5 rows.
How to make this work with with any array size ?

Some lines are long.
How to implement word wrap to new row in 80th position but between words
only ?

Andrus.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2010-03-29 14:36:09 Re: Splitting text column to multiple rows
Previous Message Juan Backson 2010-03-29 14:18:13 Re: best practice in archiving CDR data