Re: [PATCHES] heap_modifytuple

2005-01-27 Thread Neil Conway
On Wed, 2004-09-08 at 16:31 -0400, Alvaro Herrera wrote:
 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).

Patch applied to HEAD. I went to the trouble of checking the call sites
of heap_modifytuple() and using the TupleDesc of the relation if we have
already fetched it, rather than calling RelationGetDescr() again.

Thanks for the patch.

-Neil



---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [PATCHES] heap_modifytuple

2004-09-10 Thread Bruce Momjian

This has been saved for the 8.1 release:

http:/momjian.postgresql.org/cgi-bin/pgpatches2

---

Alvaro Herrera wrote:
 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?

[ Attachment, skipping... ]

 
 ---(end of broadcast)---
 TIP 3: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])


[PATCHES] heap_modifytuple

2004-09-08 Thread Alvaro Herrera
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 - 

Re: [PATCHES] heap_modifytuple

2004-09-08 Thread Tom Lane
Alvaro Herrera [EMAIL PROTECTED] writes:
 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.

I don't think that mid-beta is a good time to be indulging in purely
cosmetic cleanup ...

regards, tom lane

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster