Search Postgresql Archives

Re: how to prevent generating same clipids

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2006-04-11 at 00:43, v.suryaprabha@xxxxxxxxx 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.
Set it's next id to something like "select max(clidid)+100" and start
using the sequence to get the next clipid from.

As long as the +100 is a big enough number that you won't have overrun
the sequence with the max(clipid) before you implement the code change.

You should be able to deploy the change to your app and the sequence in
the database at about the same time, or during a maintenance window I'd
assume.

Read up on nextval() and currval() before you set this in motion. 
They're really quite an elegant solution to such issues.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux