From: Tom Lane Date: Tue, 16 Dec 2008 16:26:21 +0000 (+0000) Subject: Make heap_update() set newtup->t_tableOid correctly, for consistency with X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=65754bf1a31ee8cfcfdf81243d91e5ae54e96cea;p=users%2Fbernd%2Fpostgres.git Make heap_update() set newtup->t_tableOid correctly, for consistency with the other major heapam.c functions. The only known consequence of this omission is that UPDATE RETURNING failed to return the correct value for "tableoid", as per report from KaiGai Kohei. Back-patch to 8.2. Arguably it's wrong all the way back; but without evidence of visible breakage before RETURNING was added, I'll desist from patching the older branches. --- diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 41eb83d33e..b099dab1e0 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -2058,6 +2058,7 @@ l2: HeapTupleHeaderSetCmin(newtup->t_data, cid); HeapTupleHeaderSetXmax(newtup->t_data, 0); /* zero out Datum fields */ HeapTupleHeaderSetCmax(newtup->t_data, 0); /* for cleanliness */ + newtup->t_tableOid = RelationGetRelid(relation); /* * If the toaster needs to be activated, OR if the new tuple will not fit