Scott Marlowe <[EMAIL PROTECTED]> writes: > Daniel CAUNE <[EMAIL PROTECTED]> Said: >> I was wondering when it is better to choose sequence, and when >> it is better to use serial.
> One reason for using serial versus sequence is that a serial gives you > automatic dependency tracking. Note that as of 8.2, with the introduction of ALTER SEQUENCE OWNED BY, you can manipulate the column-to-sequence dependency by hand. This means there really is no difference between starting from a separate sequence and starting with a "serial" column declaration --- you can get to all the same database states either way. I tend to think that it's best to use a serial if you intend only the one column to use the sequence generator, whereas if you intend multiple columns to be fed from the same sequence generator you ought to declare the sequence as a freestanding object to start with. But it's just a question of style. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match