Index: contrib/pgstattuple/README.pgstattuple
===================================================================
RCS file: /home/rbt/work/postgresql/cvs/pgsql-server/contrib/pgstattuple/README.pgstattuple,v
retrieving revision 1.5
diff -c -r1.5 README.pgstattuple
*** contrib/pgstattuple/README.pgstattuple	29 Aug 2002 17:14:31 -0000	1.5
--- contrib/pgstattuple/README.pgstattuple	23 May 2003 01:45:32 -0000
***************
*** 45,51 ****
  
     CREATE OR REPLACE FUNCTION pgstattuple(text) RETURNS pgstattuple_type
       AS 'MODULE_PATHNAME', 'pgstattuple'
!      LANGUAGE 'c' WITH (isstrict);
  
     The argument is the table name.  Note that pgstattuple only returns
     one row.
--- 45,56 ----
  
     CREATE OR REPLACE FUNCTION pgstattuple(text) RETURNS pgstattuple_type
       AS 'MODULE_PATHNAME', 'pgstattuple'
!      LANGUAGE 'c' STRICT;
! 
!    CREATE OR REPLACE FUNCTION pgstattuple(oid) RETURNS pgstattuple_type
!      AS 'MODULE_PATHNAME', 'pgstattuple'
!      LANGUAGE 'c' STRICT;
! 
  
     The argument is the table name.  Note that pgstattuple only returns
     one row.
Index: contrib/pgstattuple/pgstattuple.c
===================================================================
RCS file: /home/rbt/work/postgresql/cvs/pgsql-server/contrib/pgstattuple/pgstattuple.c,v
retrieving revision 1.9
diff -c -r1.9 pgstattuple.c
*** contrib/pgstattuple/pgstattuple.c	4 Sep 2002 20:31:08 -0000	1.9
--- contrib/pgstattuple/pgstattuple.c	23 May 2003 01:42:19 -0000
***************
*** 33,40 ****
--- 33,44 ----
  
  
  PG_FUNCTION_INFO_V1(pgstattuple);
+ PG_FUNCTION_INFO_V1(pgstattuplebyid);
  
  extern Datum pgstattuple(PG_FUNCTION_ARGS);
+ extern Datum pgstattuplebyid(PG_FUNCTION_ARGS);
+ 
+ static Datum pgstattuple_real(Relation rel);
  
  /* ----------
   * pgstattuple:
***************
*** 46,52 ****
   * ----------
   */
  
! #define DUMMY_TUPLE "pgstattuple_type"
  #define NCOLUMNS 9
  #define NCHARS 32
  
--- 50,56 ----
   * ----------
   */
  
! #define DUMMY_TUPLE "public.pgstattuple_type"
  #define NCOLUMNS 9
  #define NCHARS 32
  
***************
*** 56,61 ****
--- 60,100 ----
  	text	   *relname = PG_GETARG_TEXT_P(0);
  	RangeVar   *relrv;
  	Relation	rel;
+ 	Datum		result;
+ 
+ 	/* open relation */
+ 	relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname,
+ 														 "pgstattuple"));
+ 	rel = heap_openrv(relrv, AccessShareLock);
+ 
+ 	result = pgstattuple_real(rel);
+ 
+ 	PG_RETURN_DATUM(result);
+ }
+ 
+ Datum
+ pgstattuplebyid(PG_FUNCTION_ARGS)
+ {
+ 	Oid			relid = PG_GETARG_OID(0);
+ 	Relation	rel;
+ 	Datum		result;
+ 
+ 	/* open relation */
+ 	rel = heap_open(relid, AccessShareLock);
+ 
+ 	result = pgstattuple_real(rel);
+ 
+ 	PG_RETURN_DATUM(result);
+ }
+ 
+ /*
+  * pgstattuple_real
+  *
+  * The real work occurs here
+  */
+ static Datum
+ pgstattuple_real(Relation rel)
+ {
  	HeapScanDesc scan;
  	HeapTuple	tuple;
  	BlockNumber nblocks;
***************
*** 92,102 ****
  	 */
  	attinmeta = TupleDescGetAttInMetadata(tupdesc);
  
- 	/* open relation */
- 	relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname,
- 														 "pgstattuple"));
- 	rel = heap_openrv(relrv, AccessShareLock);
- 
  	nblocks = RelationGetNumberOfBlocks(rel);
  	scan = heap_beginscan(rel, SnapshotAny, 0, NULL);
  
--- 131,136 ----
***************
*** 187,191 ****
  		pfree(values[i]);
  	pfree(values);
  
! 	PG_RETURN_DATUM(result);
  }
--- 221,225 ----
  		pfree(values[i]);
  	pfree(values);
  
! 	return(result);
  }
Index: contrib/pgstattuple/pgstattuple.sql.in
===================================================================
RCS file: /home/rbt/work/postgresql/cvs/pgsql-server/contrib/pgstattuple/pgstattuple.sql.in,v
retrieving revision 1.7
diff -c -r1.7 pgstattuple.sql.in
*** contrib/pgstattuple/pgstattuple.sql.in	14 May 2003 03:25:57 -0000	1.7
--- contrib/pgstattuple/pgstattuple.sql.in	23 May 2003 01:45:44 -0000
***************
*** 17,20 ****
  CREATE OR REPLACE FUNCTION pgstattuple(text)
  RETURNS pgstattuple_type
  AS 'MODULE_PATHNAME', 'pgstattuple'
! LANGUAGE 'C' WITH (isstrict);
--- 17,25 ----
  CREATE OR REPLACE FUNCTION pgstattuple(text)
  RETURNS pgstattuple_type
  AS 'MODULE_PATHNAME', 'pgstattuple'
! LANGUAGE 'C' STRICT;
! 
! CREATE OR REPLACE FUNCTION pgstattuple(oid)
! RETURNS pgstattuple_type
! AS 'MODULE_PATHNAME', 'pgstattuplebyid'
! LANGUAGE 'C' STRICT;
