Re: how to prevent generating same clipids

Поиск
Список
Период
Сортировка
От Ragnar
Тема Re: how to prevent generating same clipids
Дата
Msg-id 1144788307.2809.4.camel@localhost.localdomain
обсуждение исходный текст
Ответ на Re: how to prevent generating same clipids  (v.suryaprabha@gmail.com)
Список pgsql-general
On mán, 2006-04-10 at 22:43 -0700, v.suryaprabha@gmail.com wrote:
> Hi
>    Now we cannot change the field type. Because already our application
> is running and thousands of records are already entered. we are getting
> same no for clipid when 2 users are entering data at a time. so how to
> solve the problem

create a sequence:
CREATE SEQUENCE clipid_seq
   START WITH somehighenoughnumber

now use that when you allocate ids.
i.e. instead of
  SELECT 1+max(clipid) FROM yourtable
do:
  SELECT nexval(clipid_seq)

gnari



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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: execution plan : Oracle vs PostgreSQL
Следующее
От: "Magnus Hagander"
Дата:
Сообщение: Re: How to import a CSV file (originally from Excel) into a Postgresql 8.0.7 database