Re: how to prevent generating same clipids

Поиск
Список
Период
Сортировка
От Ian Harding
Тема Re: how to prevent generating same clipids
Дата
Msg-id 725602300604111400s3b01792ei1378b9c68533129a@mail.gmail.com
обсуждение исходный текст
Ответ на Re: how to prevent generating same clipids  (v.suryaprabha@gmail.com)
Список pgsql-general
This problem has been solved, by the use of sequences.  If you can't
use them as a default, you can use them instead of

MAX(clipid)

You would use

NEXTVAL(clipid_seq)

assuming you had first done

CREATE SEQUENCE clipid_seq;
SELECT SETVAL('clipid_seq', (select MAX(clipid) from whatevertable));

This will guarantee no duplicates.  It will not guarantee no missing values.

On 10 Apr 2006 22:43:16 -0700, v.suryaprabha@gmail.com
<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
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>

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

Предыдущее
От: Gaetano Mendola
Дата:
Сообщение: Re: [HACKERS] RH9 postgresql 8.0.7 rpm
Следующее
От: "Anton Andreev"
Дата:
Сообщение: table as hashtable