Re: postgres metadata
От | Tom Lane |
---|---|
Тема | Re: postgres metadata |
Дата | |
Msg-id | 19737.1069903905@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: postgres metadata (greg@turnstep.com) |
Список | pgsql-general |
greg@turnstep.com writes: > The problem is that the oid column has no "unique" constraint ... unless you add one, viz: create unique index mytable_oids on mytable (oid); which is de rigueur for any table you intend to rely on OID as an identifier for. The index is needed not only to ensure uniqueness but as a mechanism for fast access to a particular row by OID. You should be aware though that once the OID counter wraps around (every 4 billion OIDs) there is a small chance that a newly-created OID will duplicate a prior entry, resulting in a "duplicate key" failure in a transaction that really didn't do anything wrong. If you have a moral aversion to writing retry loops in your client code then this will disgust you. My own take on it is that there are enough reasons why you will need retry loops that one more shouldn't bug you. These comments generally apply to SERIAL and the other alternatives Greg mentioned, as well. The only difference is how fast do the identifiers get eaten and how far is it to the wraparound point ... regards, tom lane
В списке pgsql-general по дате отправления: