Re: spring a string to rows (Postgresql 8.4)

From: Moshe Jacobson <moshe(at)neadwerx(dot)com>
To: emilu(at)encs(dot)concordia(dot)ca
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: spring a string to rows (Postgresql 8.4)
Date: 2013-01-07 19:55:29
Message-ID: CAJ4CxLmqWx6xy3Qnb3PXgSdfUVKgRwKWQ6pRtq-ORbbybog6rQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

select id, unnest(regexp_split_to_array(col1, ',\s+'))

On Mon, Jan 7, 2013 at 2:44 PM, Emi Lu <emilu(at)encs(dot)concordia(dot)ca> wrote:

> Hello,
>
> Is there a function to split a string to different rows?
>
> For example, t1(id, col1)
> values(1, 'a, b, c');
>
> select id, string_split_to_row(col1, ',');
>
> Return:
> =========
> 1, a
> 1, b
> 1, c
>
> Thanks alot!
> Emi
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/**mailpref/pgsql-general<http://www.postgresql.org/mailpref/pgsql-general>
>

--
Moshe Jacobson
Nead Werx, Inc. | Senior Systems Engineer
2323 Cumberland Parkway, Suite 201 | Atlanta, GA 30339
moshe(at)neadwerx(dot)com | www.neadwerx.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2013-01-08 02:31:48 Re: PostgreSQL run as process in windows
Previous Message Thomas Kellerer 2013-01-07 19:54:31 Re: spring a string to rows (Postgresql 8.4)