pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedSplit a string to rows?
9+ messages / 6 participants
[nested] [flat]
* Split a string to rows?
@ 2013-01-07 19:44 Emi Lu <emilu@encs.concordia.ca>
2013-01-07 19:54 ` Re: Split a string to rows? Steve Crawford <scrawford@pinpointresearch.com>
2013-01-07 19:58 ` Re: Split a string to rows? Jonathan S. Katz <jonathan.katz@excoventures.com>
0 siblings, 2 replies; 9+ messages in thread
From: Emi Lu @ 2013-01-07 19:44 UTC (permalink / raw)
To: pgsql-sql
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-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Split a string to rows?
2013-01-07 19:44 Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
@ 2013-01-07 19:54 ` Steve Crawford <scrawford@pinpointresearch.com>
1 sibling, 0 replies; 9+ messages in thread
From: Steve Crawford @ 2013-01-07 19:54 UTC (permalink / raw)
To: emilu@encs.concordia.ca; +Cc: pgsql-sql
On 01/07/2013 11:44 AM, Emi Lu wrote:
>
> Is there a function to split a string to different rows?...
>
>
Have you looked at regexp_split_to_table?
Cheers,
Steve
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Split a string to rows?
2013-01-07 19:44 Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
@ 2013-01-07 19:58 ` Jonathan S. Katz <jonathan.katz@excoventures.com>
2013-01-07 20:16 ` Re: Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
1 sibling, 1 reply; 9+ messages in thread
From: Jonathan S. Katz @ 2013-01-07 19:58 UTC (permalink / raw)
To: emilu@encs.concordia.ca; +Cc: pgsql-sql
On Jan 7, 2013, at 2:44 PM, Emi Lu 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
You can probably use some combination of "string_to_array" and "unnest"
e.g.
SELECT unnest(string_to_array('a,b,c', ','));
unnest
--------
a
b
c
(3 rows)
If you need a more complex string splitting mechanism, there is the "regexp_split_to_array" function.
Jonathan
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Split a string to rows?
2013-01-07 19:44 Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
2013-01-07 19:58 ` Re: Split a string to rows? Jonathan S. Katz <jonathan.katz@excoventures.com>
@ 2013-01-07 20:16 ` Emi Lu <emilu@encs.concordia.ca>
2013-01-07 20:21 ` Re: Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
2013-01-07 20:31 ` Re: Split a string to rows? Thomas Kellerer <spam_eater@gmx.net>
0 siblings, 2 replies; 9+ messages in thread
From: Emi Lu @ 2013-01-07 20:16 UTC (permalink / raw)
To: Jonathan S. Katz <jonathan.katz@excoventures.com>; +Cc: pgsql-sql
Thanks a lot! I just noticed that my postgresql is 8.3(unnest function
is not there by default). Is there a way that I could download and load
only this function from somewhere?
Thanks again!
Emi
On 01/07/2013 02:58 PM, Jonathan S. Katz wrote:
> On Jan 7, 2013, at 2:44 PM, Emi Lu 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
>
>
> You can probably use some combination of "string_to_array" and "unnest"
>
> e.g.
>
> SELECT unnest(string_to_array('a,b,c', ','));
>
> unnest
> --------
> a
> b
> c
> (3 rows)
>
> If you need a more complex string splitting mechanism, there is the "regexp_split_to_array" function.
>
> Jonathan
>
--
Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
emilu@encs.concordia.ca +1 514 848-2424 x5884
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Split a string to rows?
2013-01-07 19:44 Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
2013-01-07 19:58 ` Re: Split a string to rows? Jonathan S. Katz <jonathan.katz@excoventures.com>
2013-01-07 20:16 ` Re: Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
@ 2013-01-07 20:21 ` Emi Lu <emilu@encs.concordia.ca>
1 sibling, 0 replies; 9+ messages in thread
From: Emi Lu @ 2013-01-07 20:21 UTC (permalink / raw)
To: pgsql-sql; +Cc: Jonathan S. Katz <jonathan.katz@excoventures.com>
All right. I found the function.
http://wiki.postgresql.org/wiki/Array_Unnest
Thanks a lot!
Emi
On 01/07/2013 03:16 PM, Emi Lu wrote:
> Thanks a lot! I just noticed that my postgresql is 8.3(unnest function
> is not there by default). Is there a way that I could download and load
> only this function from somewhere?
>
> Thanks again!
> Emi
>
>
> On 01/07/2013 02:58 PM, Jonathan S. Katz wrote:
>> On Jan 7, 2013, at 2:44 PM, Emi Lu 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
>>
>>
>> You can probably use some combination of "string_to_array" and "unnest"
>>
>> e.g.
>>
>> SELECT unnest(string_to_array('a,b,c', ','));
>>
>> unnest
>> --------
>> a
>> b
>> c
>> (3 rows)
>>
>> If you need a more complex string splitting mechanism, there is the
>> "regexp_split_to_array" function.
>>
>> Jonathan
>>
>
>
--
Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
emilu@encs.concordia.ca +1 514 848-2424 x5884
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Split a string to rows?
2013-01-07 19:44 Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
2013-01-07 19:58 ` Re: Split a string to rows? Jonathan S. Katz <jonathan.katz@excoventures.com>
2013-01-07 20:16 ` Re: Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
@ 2013-01-07 20:31 ` Thomas Kellerer <spam_eater@gmx.net>
2013-01-08 14:34 ` Re: Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
1 sibling, 1 reply; 9+ messages in thread
From: Thomas Kellerer @ 2013-01-07 20:31 UTC (permalink / raw)
To: pgsql-sql
Emi Lu wrote on 07.01.2013 21:16:
> Thanks a lot! I just noticed that my postgresql is 8.3(unnest
> function is not there by default). Is there a way that I could
> download and load only this function from somewhere?
Are you aware that 8.3 will be de-suppported as of next month?
You should really think about an upgrade *now*
Thomas
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Split a string to rows?
2013-01-07 19:44 Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
2013-01-07 19:58 ` Re: Split a string to rows? Jonathan S. Katz <jonathan.katz@excoventures.com>
2013-01-07 20:16 ` Re: Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
2013-01-07 20:31 ` Re: Split a string to rows? Thomas Kellerer <spam_eater@gmx.net>
@ 2013-01-08 14:34 ` Emi Lu <emilu@encs.concordia.ca>
2013-01-08 14:37 ` Re: Split a string to rows? ktm@rice.edu <ktm@rice.edu>
2013-01-08 14:39 ` Re: Split a string to rows? Dave Page <dpage@pgadmin.org>
0 siblings, 2 replies; 9+ messages in thread
From: Emi Lu @ 2013-01-08 14:34 UTC (permalink / raw)
To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: pgsql-sql
Hello Thomas,
>> Thanks a lot! I just noticed that my postgresql is 8.3(unnest
>> function is not there by default). Is there a way that I could
>> download and load only this function from somewhere?
>
>
> Are you aware that 8.3 will be de-suppported as of next month?
>
> You should really think about an upgrade *now*
>
http://www.postgresql.org/support/versioning/
Although 8.3 reaches EOL date, it says that "Supported=Yes" for 8.3.
I believe that "Supported" would be fine, wouldn't it?
Emi
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Split a string to rows?
2013-01-07 19:44 Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
2013-01-07 19:58 ` Re: Split a string to rows? Jonathan S. Katz <jonathan.katz@excoventures.com>
2013-01-07 20:16 ` Re: Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
2013-01-07 20:31 ` Re: Split a string to rows? Thomas Kellerer <spam_eater@gmx.net>
2013-01-08 14:34 ` Re: Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
@ 2013-01-08 14:37 ` ktm@rice.edu <ktm@rice.edu>
1 sibling, 0 replies; 9+ messages in thread
From: ktm@rice.edu @ 2013-01-08 14:37 UTC (permalink / raw)
To: Emi Lu <emilu@encs.concordia.ca>; +Cc: Thomas Kellerer <spam_eater@gmx.net>; pgsql-sql
On Tue, Jan 08, 2013 at 09:34:24AM -0500, Emi Lu wrote:
> Hello Thomas,
>
> >>Thanks a lot! I just noticed that my postgresql is 8.3(unnest
> >>function is not there by default). Is there a way that I could
> >>download and load only this function from somewhere?
> >
> >
> >Are you aware that 8.3 will be de-suppported as of next month?
> >
> >You should really think about an upgrade *now*
> >
>
> http://www.postgresql.org/support/versioning/
>
> Although 8.3 reaches EOL date, it says that "Supported=Yes" for 8.3.
>
> I believe that "Supported" would be fine, wouldn't it?
>
> Emi
>
Hi Emi,
It will be supported until February 2013. You have about 1 month left.
Regards,
Ken
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Split a string to rows?
2013-01-07 19:44 Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
2013-01-07 19:58 ` Re: Split a string to rows? Jonathan S. Katz <jonathan.katz@excoventures.com>
2013-01-07 20:16 ` Re: Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
2013-01-07 20:31 ` Re: Split a string to rows? Thomas Kellerer <spam_eater@gmx.net>
2013-01-08 14:34 ` Re: Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
@ 2013-01-08 14:39 ` Dave Page <dpage@pgadmin.org>
1 sibling, 0 replies; 9+ messages in thread
From: Dave Page @ 2013-01-08 14:39 UTC (permalink / raw)
To: emilu@encs.concordia.ca; +Cc: Thomas Kellerer <spam_eater@gmx.net>; pgsql-sql
On Tue, Jan 8, 2013 at 2:34 PM, Emi Lu <emilu@encs.concordia.ca> wrote:
> Hello Thomas,
>
>
>>> Thanks a lot! I just noticed that my postgresql is 8.3(unnest
>>> function is not there by default). Is there a way that I could
>>> download and load only this function from somewhere?
>>
>>
>>
>> Are you aware that 8.3 will be de-suppported as of next month?
>>
>> You should really think about an upgrade *now*
>>
>
> http://www.postgresql.org/support/versioning/
>
> Although 8.3 reaches EOL date, it says that "Supported=Yes" for 8.3.
>
> I believe that "Supported" would be fine, wouldn't it?
It is supported until February (or more precisely, until the next
point release after then, which will be the final wrapup release). At
that point, there will be no more releases or bug fixes.
Start thinking about upgrading now, as Thomas suggests.
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2013-01-08 14:39 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-01-07 19:44 Split a string to rows? Emi Lu <emilu@encs.concordia.ca>
2013-01-07 19:54 ` Steve Crawford <scrawford@pinpointresearch.com>
2013-01-07 19:58 ` Jonathan S. Katz <jonathan.katz@excoventures.com>
2013-01-07 20:16 ` Emi Lu <emilu@encs.concordia.ca>
2013-01-07 20:21 ` Emi Lu <emilu@encs.concordia.ca>
2013-01-07 20:31 ` Thomas Kellerer <spam_eater@gmx.net>
2013-01-08 14:34 ` Emi Lu <emilu@encs.concordia.ca>
2013-01-08 14:37 ` ktm@rice.edu <ktm@rice.edu>
2013-01-08 14:39 ` Dave Page <dpage@pgadmin.org>
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