mirror of
https://github.com/postgres/postgres.git
synced 2025-10-28 11:55:03 +03:00
Code review for FILLFACTOR patch. Change WITH grammar as per earlier
discussion (including making def_arg allow reserved words), add missed opt_definition for UNIQUE case. Put the reloptions support code in a less random place (I chose to make a new file access/common/reloptions.c). Eliminate header inclusion creep. Make the index options functions safely user-callable (seems like client apps might like to be able to test validity of options before trying to make an index). Reduce overhead for normal case with no options by allowing rd_options to be NULL. Fix some unmaintainably klugy code, including getting rid of Natts_pg_class_fixed at long last. Some stylistic cleanup too, and pay attention to keeping comments in sync with code. Documentation still needs work, though I did fix the omissions in catalogs.sgml and indexam.sgml.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.113 2006/07/02 02:23:22 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.114 2006/07/03 22:45:39 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "nodes/primnodes.h"
|
||||
#include "storage/block.h"
|
||||
#include "storage/lmgr.h"
|
||||
#include "utils/array.h"
|
||||
#include "utils/rel.h"
|
||||
#include "utils/tqual.h"
|
||||
|
||||
@@ -228,32 +227,4 @@ extern MinimalTuple minimal_tuple_from_heap_tuple(HeapTuple htup);
|
||||
extern HeapTuple heap_addheader(int natts, bool withoid,
|
||||
Size structlen, void *structure);
|
||||
|
||||
extern HeapTuple build_class_tuple(Form_pg_class pgclass, ArrayType *options);
|
||||
|
||||
/*
|
||||
* HeapOption
|
||||
* Internal data of heaps.
|
||||
*/
|
||||
typedef struct HeapOption
|
||||
{
|
||||
int32 vl_len;
|
||||
int fillfactor;
|
||||
} HeapOption;
|
||||
|
||||
extern bytea *heap_option(char relkind, ArrayType *options);
|
||||
|
||||
/*
|
||||
* HeapGetFillFactor
|
||||
* Returns the heap's fillfactor.
|
||||
*/
|
||||
#define HeapGetFillFactor(relation) \
|
||||
(((HeapOption*)(relation)->rd_options)->fillfactor)
|
||||
|
||||
/*
|
||||
* HeapGetPageFreeSpace
|
||||
* Returns the heap's freespace per page in bytes.
|
||||
*/
|
||||
#define HeapGetPageFreeSpace(relation) \
|
||||
(BLCKSZ * (100 - HeapGetFillFactor(relation)) / 100)
|
||||
|
||||
#endif /* HEAPAM_H */
|
||||
|
||||
Reference in New Issue
Block a user