Re: Best approach for a "gap-less" sequence
От
Richard Broersma Jr
Тема
Re: Best approach for a "gap-less" sequence
Дата
Msg-id
20060814162836.58963.qmail@web31811.mail.mud.yahoo.com
Ответ на
Re: Best approach for a "gap-less" sequence (Harald Fuchs)
Список
Дерево обсуждения
Re: Best approach for a "gap-less" sequence Harald Fuchs <hf0731x@protecting.net>
Re: Best approach for a "gap-less" sequence Richard Broersma Jr <rabroersma@yahoo.com>
Re: Best approach for a "gap-less" sequence Jorge Godoy <jgodoy@gmail.com>
Re: Best approach for a "gap-less" sequence Scott Ribe <scott_ribe@killerbytes.com>
> > AgentM writes: > >> Since the gapless numbers are purely for the benefit of the tax people, you > >> could build your db with regular sequences as primary keys and then regularly > >> (or just before tax-time) insert into a table which maps the gapless sequence > >> to the real primary key. > > > That's also an interesting approach. An auxiliary table like > > > transaction integer FK to the transactions table > > transaction_nb integer gapless sequence > > > should do it. A trigger inserting on this auxiliary table would also take > > care of everything... If I have an after trigger I believe I wouldn't need > > any locking... I have to think about this... > > Why putting gapless numbers into the database at all? Just calculate them at > query time. I am curious, can you calculate something like this using only sql? Or you you need to employee a procedural language like plpsgql? Regards, Richard Broersma Jr.
В списке pgsql-general по дате отправления