Re: how to prevent generating same clipids

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: how to prevent generating same clipids
Дата
Msg-id 1144787789.32269.95.camel@state.g2switchworks.com
обсуждение исходный текст
Ответ на Re: how to prevent generating same clipids  (v.suryaprabha@gmail.com)
Список pgsql-general
On Tue, 2006-04-11 at 00:43, 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

Addendum:

Note that you can also set the default for the clipid column to be the
nextval('sequencename') at the same time, then if anyone DOES insert a
row without getting the nextval() first, it'll still give them the
proper value.

Note that a "serial" type is actually just an int with a default and a
dependency.

Also, you really should have a primary key or unique index with not null
attribute on the clipid column as well, just to be safe.  PK is about
the same as unique & not null, just that foreign references aren't
automatic, but I get the feeling foreign keys aren't playing a role in
your schema just now.

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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: how to prevent generating same clipids
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: execution plan : Oracle vs PostgreSQL