On Tue, 27 Jan 2004, Jeremy Buchmann wrote:
> On Jan 27, 2004, at 11:35 AM, Andrew Nelson wrote:
>
> > I've always wondered if something like this is totally safe. What if
> > someone somewhere else outside of my code ran a insert or update that
> > didn't use the sequence at all but changed the id. And that id turned
> > out to be the same as the id collect from the select
> > nextval('sequence');
> >
> > So I guess you would need to add a lock of some sorts.
> > Just wondering because this is something I have fought with for a long
> > time.
>
> Well, it's only safe if you use the sequence. If you don't, you're on
> your own.
>
> Cheers,
> Jeremy
You could always program a before trigger that would not let you directly
insert or update that column, and would only use the sequence.