1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

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.
This commit is contained in:
Tom Lane
2002-03-30 01:02:42 +00:00
parent 25004eec95
commit 5f4745adf4
14 changed files with 261 additions and 178 deletions

View File

@ -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);