renumber id's in correct order (compact id's)

Поиск
Список
Период
Сортировка
От peter pilsl
Тема renumber id's in correct order (compact id's)
Дата
Msg-id 42B7CA90.6020600@goldfisch.at
обсуждение исходный текст
Ответы Re: renumber id's in correct order (compact id's)  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-general

I've entries with id's like:

  x | id
---+----
  b |  1
  a |  4
  e |  5
  c | 12
  d | 19
(5 rows)


now I'd like to have the id in continuing number to get:

  x | id
---+----
  b |  1
  a |  2
  e |  3
  c |  4
  d |  5
(5 rows)


Simpliest way to do would be to create a sequence and update the whole
table using nextval on the sequencec. Unfortunately UPDATE does not know
about an order-statement.

Any Idea,
thnx,
peter





--
mag. peter pilsl
goldfisch.at
IT-management
tel +43 699 1 3574035
fae +43 699 4 3574035
pilsl@goldfisch.at

В списке pgsql-general по дате отправления:

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: Access is denied during initdb
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: problems with types after update to 8.0