Updating OID column

Started by Peter Eisentrautalmost 20 years ago5 messages
#1Peter Eisentraut
peter_e@gmx.net

Is there a reason for why you can't update the OID column other than that no
one has bothered to code up the support for it?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

#2Qingqing Zhou
zhouqq@cs.toronto.edu
In reply to: Peter Eisentraut (#1)
Re: Updating OID column

"Peter Eisentraut" <peter_e@gmx.net> wrote

Is there a reason for why you can't update the OID column other than that

no

one has bothered to code up the support for it?

AFAIK if two rows are with the same OID, we will think these two rows are
different versions of the same tuple. So if we allow users to change OID
columns, we may encounter some inconsistency.

Regards,
Qingqing

#3Martijn van Oosterhout
kleptog@svana.org
In reply to: Qingqing Zhou (#2)
Re: Updating OID column

On Mon, Apr 10, 2006 at 04:40:50PM +0800, Qingqing Zhou wrote:

"Peter Eisentraut" <peter_e@gmx.net> wrote

Is there a reason for why you can't update the OID column other than that

no

one has bothered to code up the support for it?

AFAIK if two rows are with the same OID, we will think these two rows are
different versions of the same tuple. So if we allow users to change OID
columns, we may encounter some inconsistency.

Hardly, OIDs are optional anyway these days. We only guarentee that
OIDs will be unique if you have a unique index on them, so I imagine
the only reason it hasn't happened yet is because nobody's coded it.

How about when you select from a table with OIDs that it shows the OID
column? That would be the final step, wouldn't it?

Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/

Show quoted text

Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
tool for doing 5% of the work and then sitting around waiting for someone
else to do the other 95% so you can sue them.

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Martijn van Oosterhout (#3)
Re: Updating OID column

Martijn van Oosterhout <kleptog@svana.org> writes:

On Mon, Apr 10, 2006 at 04:40:50PM +0800, Qingqing Zhou wrote:

AFAIK if two rows are with the same OID, we will think these two rows are
different versions of the same tuple. So if we allow users to change OID
columns, we may encounter some inconsistency.

Hardly, OIDs are optional anyway these days. We only guarentee that
OIDs will be unique if you have a unique index on them, so I imagine
the only reason it hasn't happened yet is because nobody's coded it.

Right. I looked at this awhile back, though, and found multiple places
that would break if you tried it :-( --- mainly assumptions about the
meaning of resno in target lists. (The comments for the TargetEntry
struct give some but not all of the details.) Given that OID is
semi-deprecated anyway these days, it's not clear it's worth fixing.

regards, tom lane

#5Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#4)
Re: Updating OID column

Tom Lane wrote:

Right. I looked at this awhile back, though, and found multiple
places that would break if you tried it :-( --- mainly assumptions
about the meaning of resno in target lists. (The comments for the
TargetEntry struct give some but not all of the details.) Given that
OID is semi-deprecated anyway these days, it's not clear it's worth
fixing.

I came across this while restoring a botched backup. I imported a
schema dump and copied over various data files, adjusted the
transaction IDs, relfilenodes, etc., but the OIDs of the TOAST tables
are stored in the fields, so it seemed that the OIDs of the TOAST table
entries in pg_class would have to be adjusted. I managed to fix up the
few broken references manually in a binary editor, but having OIDs
updatable would have been handy if more TOAST values had needed fixing.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/