"chester c young" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > > > CREATE TABLE items ( > > id INT, > > typ INT ... > > PRIMAY KEY (seq,typ)); > > > > > id typ > > ----+----- > > 1 'a' > > 2 'a' > > 3 'a' > > 1 'b' > > 4 'a' > > 2 'b' > > you will need to use pre insert trigger since you cannot use column > references in default expression. > > you could use this same trigger to either: > - create sequences as needed and apply the right one > - with locking, lookup for last id of typ > - with locking, keep another table of typ and nextval
Thanks, that summerizes the options nicely. I noticed that sequences are tables with a single row that defines the sequence properties. I was hoping that there was some way of using a sequence with multiple rows to maintain multiplre sequences in a sngle table, which would make having a large number of sequences a little less cluttered, but sounds like I need to implement that from scratch. ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly