diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-03-30 01:02:42 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-03-30 01:02:42 +0000 |
commit | 5f4745adf4fb2a1f933b25d7a2bc72b39fa9edfd (patch) | |
tree | e024d7d1a3eb76220378e4054bf34485812962ea /contrib/pgstattuple/pgstattuple.c | |
parent | 25004eec957853a55789398d4228d7e77d4877c1 (diff) | |
download | postgresql-5f4745adf4fb2a1f933b25d7a2bc72b39fa9edfd.tar.gz postgresql-5f4745adf4fb2a1f933b25d7a2bc72b39fa9edfd.zip |
Further cleanups for relations in schemas: teach nextval and other
sequence functions how to cope with qualified names. Same code is
also used for int4notin, currtid_byrelname, pgstattuple. Also,
move TOAST tables into special pg_toast namespace.
Diffstat (limited to 'contrib/pgstattuple/pgstattuple.c')
-rw-r--r-- | contrib/pgstattuple/pgstattuple.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/contrib/pgstattuple/pgstattuple.c b/contrib/pgstattuple/pgstattuple.c index beda282172d..39bd5d1f95e 100644 --- a/contrib/pgstattuple/pgstattuple.c +++ b/contrib/pgstattuple/pgstattuple.c @@ -1,5 +1,5 @@ /* - * $Header: /cvsroot/pgsql/contrib/pgstattuple/pgstattuple.c,v 1.4 2002/03/06 06:09:10 momjian Exp $ + * $Header: /cvsroot/pgsql/contrib/pgstattuple/pgstattuple.c,v 1.5 2002/03/30 01:02:41 tgl Exp $ * * Copyright (c) 2001 Tatsuo Ishii * @@ -27,6 +27,9 @@ #include "fmgr.h" #include "access/heapam.h" #include "access/transam.h" +#include "catalog/namespace.h" +#include "utils/builtins.h" + PG_FUNCTION_INFO_V1(pgstattuple); @@ -43,8 +46,8 @@ extern Datum pgstattuple(PG_FUNCTION_ARGS); Datum pgstattuple(PG_FUNCTION_ARGS) { - Name p = PG_GETARG_NAME(0); - + text *relname = PG_GETARG_TEXT_P(0); + RangeVar *relrv; Relation rel; HeapScanDesc scan; HeapTuple tuple; @@ -59,11 +62,13 @@ pgstattuple(PG_FUNCTION_ARGS) uint64 dead_tuple_count = 0; double tuple_percent; double dead_tuple_percent; - uint64 free_space = 0; /* free/reusable space in bytes */ double free_percent; /* free/reusable space in % */ - rel = heap_openr(NameStr(*p), AccessShareLock); + relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname, + "pgstattuple")); + rel = heap_openrv(relrv, AccessShareLock); + nblocks = RelationGetNumberOfBlocks(rel); scan = heap_beginscan(rel, false, SnapshotAny, 0, NULL); |