~ubuntu-branches/ubuntu/natty/postgresql-8.4/natty-security

« back to all changes in this revision

Viewing changes to contrib/pgstattuple/pgstattuple.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-11 16:59:35 UTC
  • mfrom: (5.1.1 karmic)
  • Revision ID: james.westby@ubuntu.com-20090711165935-jfwin6gfrxf0gfsi
Tags: 8.4.0-2
* debian/libpq-dev.install: Ship catalog/genbki.h. (Closes: #536139)
* debian/rules: Drop --enable-cassert for final release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.37 2009/03/31 22:54:31 tgl Exp $
 
2
 * $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.38 2009/06/11 14:48:52 momjian Exp $
3
3
 *
4
4
 * Copyright (c) 2001,2002      Tatsuo Ishii
5
5
 *
59
59
        uint64          dead_tuple_count;
60
60
        uint64          dead_tuple_len;
61
61
        uint64          free_space;             /* free/reusable space in bytes */
62
 
}       pgstattuple_type;
 
62
} pgstattuple_type;
63
63
 
64
64
typedef void (*pgstat_page) (pgstattuple_type *, Relation, BlockNumber);
65
65
 
66
 
static Datum build_pgstattuple_type(pgstattuple_type * stat,
 
66
static Datum build_pgstattuple_type(pgstattuple_type *stat,
67
67
                                           FunctionCallInfo fcinfo);
68
68
static Datum pgstat_relation(Relation rel, FunctionCallInfo fcinfo);
69
69
static Datum pgstat_heap(Relation rel, FunctionCallInfo fcinfo);
70
 
static void pgstat_btree_page(pgstattuple_type * stat,
 
70
static void pgstat_btree_page(pgstattuple_type *stat,
71
71
                                  Relation rel, BlockNumber blkno);
72
 
static void pgstat_hash_page(pgstattuple_type * stat,
 
72
static void pgstat_hash_page(pgstattuple_type *stat,
73
73
                                 Relation rel, BlockNumber blkno);
74
 
static void pgstat_gist_page(pgstattuple_type * stat,
 
74
static void pgstat_gist_page(pgstattuple_type *stat,
75
75
                                 Relation rel, BlockNumber blkno);
76
76
static Datum pgstat_index(Relation rel, BlockNumber start,
77
77
                         pgstat_page pagefn, FunctionCallInfo fcinfo);
78
 
static void pgstat_index_page(pgstattuple_type * stat, Page page,
 
78
static void pgstat_index_page(pgstattuple_type *stat, Page page,
79
79
                                  OffsetNumber minoff, OffsetNumber maxoff);
80
80
 
81
81
/*
82
82
 * build_pgstattuple_type -- build a pgstattuple_type tuple
83
83
 */
84
84
static Datum
85
 
build_pgstattuple_type(pgstattuple_type * stat, FunctionCallInfo fcinfo)
 
85
build_pgstattuple_type(pgstattuple_type *stat, FunctionCallInfo fcinfo)
86
86
{
87
87
#define NCOLUMNS        9
88
88
#define NCHARS          32
200
200
        const char *err;
201
201
 
202
202
        /*
203
 
         * Reject attempts to read non-local temporary relations; we would
204
 
         * be likely to get wrong data since we have no visibility into the
205
 
         * owning session's local buffers.
 
203
         * Reject attempts to read non-local temporary relations; we would be
 
204
         * likely to get wrong data since we have no visibility into the owning
 
205
         * session's local buffers.
206
206
         */
207
207
        if (RELATION_IS_OTHER_TEMP(rel))
208
208
                ereport(ERROR,
331
331
 * pgstat_btree_page -- check tuples in a btree page
332
332
 */
333
333
static void
334
 
pgstat_btree_page(pgstattuple_type * stat, Relation rel, BlockNumber blkno)
 
334
pgstat_btree_page(pgstattuple_type *stat, Relation rel, BlockNumber blkno)
335
335
{
336
336
        Buffer          buf;
337
337
        Page            page;
374
374
 * pgstat_hash_page -- check tuples in a hash page
375
375
 */
376
376
static void
377
 
pgstat_hash_page(pgstattuple_type * stat, Relation rel, BlockNumber blkno)
 
377
pgstat_hash_page(pgstattuple_type *stat, Relation rel, BlockNumber blkno)
378
378
{
379
379
        Buffer          buf;
380
380
        Page            page;
417
417
 * pgstat_gist_page -- check tuples in a gist page
418
418
 */
419
419
static void
420
 
pgstat_gist_page(pgstattuple_type * stat, Relation rel, BlockNumber blkno)
 
420
pgstat_gist_page(pgstattuple_type *stat, Relation rel, BlockNumber blkno)
421
421
{
422
422
        Buffer          buf;
423
423
        Page            page;
480
480
 * pgstat_index_page -- for generic index page
481
481
 */
482
482
static void
483
 
pgstat_index_page(pgstattuple_type * stat, Page page,
 
483
pgstat_index_page(pgstattuple_type *stat, Page page,
484
484
                                  OffsetNumber minoff, OffsetNumber maxoff)
485
485
{
486
486
        OffsetNumber i;