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.
>