Search Postgresql Archives

Re: Splitting text column to multiple rows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/3/29 Andrus <kobruleht2@xxxxxx>:
>> 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.
>

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux