Re: Best approach for a "gap-less" sequence
От | Harald Fuchs |
---|---|
Тема | Re: Best approach for a "gap-less" sequence |
Дата | |
Msg-id | pufyfzffu7.fsf@srv.protecting.net обсуждение исходный текст |
Ответ на | Best approach for a "gap-less" sequence (Jorge Godoy <jgodoy@gmail.com>) |
Ответы |
Re: Best approach for a "gap-less" sequence
Re: Best approach for a "gap-less" sequence Re: Best approach for a "gap-less" sequence |
Список | pgsql-general |
In article <878xlrwcxm.fsf@gmail.com>, Jorge Godoy <jgodoy@gmail.com> writes: > AgentM <agentm@themactionfaction.com> 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.
В списке pgsql-general по дате отправления: