Re: Splitting text column to multiple rows - Mailing list pgsql-general

From Pavel Stehule
Subject Re: Splitting text column to multiple rows
Date
Msg-id 162867791003290542v34afc0e4x950cd82ce94d8995@mail.gmail.com
Whole thread Raw
In response to Re: Splitting text column to multiple rows  ("Andrus" <kobruleht2@hot.ee>)
List pgsql-general
2010/3/29 Andrus <kobruleht2@hot.ee>:
>> no it is in same order. generate_series generates indexes from
>
> 1,2,3.... so result have to be exactly in same order. You do some
> wrong.
>
> In my sample I used joind and projecton this changes order.
> How to add order number 1,2,.. to created table ?
>

you cannot use join for this task

you can use some trick - using a sequences

http://www.postgresql.org/files/documentation/books/aw_pgsql/node75.html
postgres=# create temp SEQUENCE xx;
CREATE SEQUENCE
Time: 3,496 ms
postgres=# select nextval('xx'), * from gg;
 nextval | a  | b
---------+----+----
       1 | 10 | 33
       2 | 55 | 22
(2 rows)

Time: 0,926 ms
postgres=# select * from gg;
 a  | b
----+----
 10 | 33
 55 | 22
(2 rows)

regards
Pavel Stehule


> Andrus.
>

pgsql-general by date:

Previous
From: raghavendra t
Date:
Subject: How to give security to pg_catalogs
Next
From: Juan Backson
Date:
Subject: best practice in archiving CDR data