"Andrew Dunstan" <andrew@dunslane.net> writes:
> If we were implementing serial from scratch, I would be arguing that the
> underlying sequence should be merely an implementation detail that should
> be totally hidden, and sequences used explicitly should be kept as a
> separate concept. Then many of these problems simply wouldn't exist. I
> realise that might be difficult to get to now :-(
Well, we're not in a green field anymore :-(. In any case there would
be some serious practical disadvantages in trying to hide the underlying
sequence fully:
* you couldn't use ALTER SEQUENCE, eg to adjust the sequence's CYCLE
property, which seems like a useful thing to do;
* permissions management would get interesting too;
* how's pg_dump going to access the sequence to restore its correct
count value etc?
I think we'd end up building a lot of facilities parallel to those that
exist for "ordinary" sequences, and then this doesn't seem like such a
clean solution anymore...
regards, tom lane