From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Andrus <kobruleht2(at)hot(dot)ee> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Splitting text column to multiple rows |
Date: | 2010-03-29 12:42:59 |
Message-ID: | 162867791003290542v34afc0e4x950cd82ce94d8995@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
2010/3/29 Andrus <kobruleht2(at)hot(dot)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.
>
From | Date | Subject | |
---|---|---|---|
Next Message | Juan Backson | 2010-03-29 13:27:37 | best practice in archiving CDR data |
Previous Message | raghavendra t | 2010-03-29 12:39:25 | How to give security to pg_catalogs |