Bonjour,
Je recupere le dernier enregistrement de ma table à l aide de l'OID.
Je voudrais savoir le derniere enregistrement aura toujours l'OID le plus grand ?
Merci.
Bonjour,
Je recupere le dernier enregistrement de ma table à l aide de l'OID.
Je voudrais savoir le derniere enregistrement aura toujours l'OID le plus grand ?
Merci.
Reponse lu dans la doc
Donc les OID sont à éviter en tant qu'identifiant unique car ils peuvent reboucler.OIDs are 32-bit quantities and are assigned from a single cluster-wide counter. In a large or long-lived database, it is possible for the counter to wrap around. Hence, it is bad practice to assume that OIDs are unique, unless you take steps to ensure that this is the case. If you need to identify the rows in a table, using a sequence generator is strongly recommended. However, OIDs can be used as well, provided that a few additional precautions are taken:
A unique constraint should be created on the OID column of each table for which the OID will be used to identify rows.
OIDs should never be assumed to be unique across tables; use the combination of tableoid and row OID if you need a database-wide identifier.
The tables in question should be created using WITH OIDS to ensure forward compatibility with future releases of PostgreSQL. It is planned that WITHOUT OIDS will become the default.
KrysKool
merci
Partager