Patchers,
Here is a simple patch that changes heap_modifytuple to require a
TupleDesc instead of a Relation (driven off a comment in the same
function). I didn't really look to see if anything can be simplified
because of this change.
All backend callers changed; there are no callers in contrib (that grep
can find, that is). Regression test pass, no new compiler warning
generated.
--
Alvaro Herrera (alvherre[a]dcc.uchile.cl)
La verdad no siempre es bonita, pero el hambre de ella sí
Index: src/backend/access/common/heaptuple.c
===
RCS file: /home/alvherre/cvs/pgsql-server/src/backend/access/common/heaptuple.c,v
retrieving revision 1.94
diff -c -r1.94 heaptuple.c
*** src/backend/access/common/heaptuple.c 29 Aug 2004 05:06:39 - 1.94
--- src/backend/access/common/heaptuple.c 8 Sep 2004 19:45:06 -
***
*** 662,680
*
*forms a new tuple from an old tuple and a set of replacement values.
*returns a new palloc'ed tuple.
- *
- *XXX it is misdesign that this is passed a Relation and not just a
- *TupleDesc to describe the tuple structure.
*
*/
HeapTuple
heap_modifytuple(HeapTuple tuple,
!Relation relation,
Datum *replValues,
char *replNulls,
char *replActions)
{
- TupleDesc tupleDesc = RelationGetDescr(relation);
int numberOfAttributes = tupleDesc-natts;
int attoff;
Datum *values;
--- 662,676
*
*forms a new tuple from an old tuple and a set of replacement values.
*returns a new palloc'ed tuple.
*
*/
HeapTuple
heap_modifytuple(HeapTuple tuple,
!TupleDesc tupleDesc,
Datum *replValues,
char *replNulls,
char *replActions)
{
int numberOfAttributes = tupleDesc-natts;
int attoff;
Datum *values;
Index: src/backend/catalog/aclchk.c
===
RCS file: /home/alvherre/cvs/pgsql-server/src/backend/catalog/aclchk.c,v
retrieving revision 1.107
diff -c -r1.107 aclchk.c
*** src/backend/catalog/aclchk.c29 Aug 2004 05:06:41 - 1.107
--- src/backend/catalog/aclchk.c8 Sep 2004 19:54:00 -
***
*** 373,379
replaces[Anum_pg_class_relacl - 1] = 'r';
values[Anum_pg_class_relacl - 1] = PointerGetDatum(new_acl);
! newtuple = heap_modifytuple(tuple, relation, values, nulls, replaces);
ReleaseSysCache(tuple);
--- 373,379
replaces[Anum_pg_class_relacl - 1] = 'r';
values[Anum_pg_class_relacl - 1] = PointerGetDatum(new_acl);
! newtuple = heap_modifytuple(tuple, RelationGetDescr(relation), values,
nulls, replaces);
ReleaseSysCache(tuple);
***
*** 531,537
replaces[Anum_pg_database_datacl - 1] = 'r';
values[Anum_pg_database_datacl - 1] = PointerGetDatum(new_acl);
! newtuple = heap_modifytuple(tuple, relation, values, nulls, replaces);
simple_heap_update(relation, newtuple-t_self, newtuple);
--- 531,537
replaces[Anum_pg_database_datacl - 1] = 'r';
values[Anum_pg_database_datacl - 1] = PointerGetDatum(new_acl);
! newtuple = heap_modifytuple(tuple, RelationGetDescr(relation), values,
nulls, replaces);
simple_heap_update(relation, newtuple-t_self, newtuple);
***
*** 685,691
replaces[Anum_pg_proc_proacl - 1] = 'r';
values[Anum_pg_proc_proacl - 1] = PointerGetDatum(new_acl);
! newtuple = heap_modifytuple(tuple, relation, values, nulls, replaces);
ReleaseSysCache(tuple);
--- 685,691
replaces[Anum_pg_proc_proacl - 1] = 'r';
values[Anum_pg_proc_proacl - 1] = PointerGetDatum(new_acl);
! newtuple = heap_modifytuple(tuple, RelationGetDescr(relation), values,
nulls, replaces);
ReleaseSysCache(tuple);
***
*** 848,854
replaces[Anum_pg_language_lanacl - 1] = 'r';
values[Anum_pg_language_lanacl - 1] = PointerGetDatum(new_acl);
! newtuple = heap_modifytuple(tuple, relation, values, nulls, replaces);
ReleaseSysCache(tuple);
--- 848,854
replaces[Anum_pg_language_lanacl - 1] = 'r';
values[Anum_pg_language_lanacl -