I have a PostgreSQL table, and I need to create a view with a new column. This column needs to be an auto-incremental column starting at 1 and going to N.
Is this possible to do without effecting the original schema of the legacy data structure?
I have a PostgreSQL table, and I need to create a view with a new column. This column needs to be an auto-incremental column starting at 1 and going to N. Is this possible to do without effecting the original schema of the legacy data structure? |
||||
As @deszo said user OVER()
|
|||||||||||||||||
|
row_number OVER ()
(a window function) for this, if I understand it correctly. – dezso Jan 16 '14 at 12:36