I have what may be a half-baked idea for allowing nextval and friends to work with a true sequence-name parameter, rather than a string equivalent. Suppose that we invent a new datatype "regclass", similar to regproc: it's actually an OID, but it has the additional implication that it is the OID of a pg_class row, and the I/O operations for the type try to accept or print a class name not just a numeric OID. Next, hack the parser to understand that when a function has an argument declared as type regclass and is invoked with the syntax relname.func or func(relname), what is wanted is for the OID of the relation to be passed as a constant argument; the relation is NOT inserted into the query's rangetable. Then, it's a simple matter to write a variant of nextval that identifies its target sequence by OID rather than name. The function will still be responsible for ensuring that what it's pointed at is indeed a sequence, since the parser won't enforce that. I haven't yet studied the parser to see how much of a hack this would be, but it seems doable. The facility might be of use for other functions besides the sequence ones, too. Thoughts? regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 3: 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