On Sun, Sep 12, 2004 at 09:16:37 -0700,
Nick <nboutelier@hotmail.com> wrote:
> This is actually a table that holds message threads for message
> boards. Column A is really 'message_board_id' and column B is
> 'thread_id'. I would like every new thread for a message board to have
> a 'thread_id' of 1 and increment from there on. -Nick
Since thread ids should be opaque just use one sequence that generates
all thread ids rather than having separate thread id sets for each message
board id.
If you really want to have thread ids start at 1 and increase by 1 for
each new thread per message boad, sequences aren't the right tool.
The simplest way to do this is when adding a new thread to lock the
table against concurrent updates and then use a new thread id that
is one higher than the current highest for the message board of interest.
This doesn't handle what to do if you need to delete a thread.