mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
Add FILLFACTOR to CREATE INDEX.
ITAGAKI Takahiro
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.55 2006/05/07 01:21:30 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.56 2006/07/02 02:23:18 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* many of the old access method routines have been turned into
|
||||
@@ -21,8 +21,12 @@
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "access/heapam.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "miscadmin.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "parser/parse_clause.h"
|
||||
#include "pgstat.h"
|
||||
#include "utils/catcache.h"
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
@@ -260,3 +264,44 @@ systable_endscan(SysScanDesc sysscan)
|
||||
|
||||
pfree(sysscan);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse options for generic indexes.
|
||||
*/
|
||||
bytea *
|
||||
genam_option(ArrayType *options,
|
||||
int minFillfactor, int defaultFillfactor)
|
||||
{
|
||||
int fillfactor;
|
||||
IndexOption *result;
|
||||
|
||||
DefElem kwds[] =
|
||||
{
|
||||
{ T_DefElem, "fillfactor" },
|
||||
};
|
||||
|
||||
/*
|
||||
* parse options
|
||||
*/
|
||||
OptionParse(options, lengthof(kwds), kwds, true);
|
||||
|
||||
/* 0: fillfactor */
|
||||
if (kwds[0].arg)
|
||||
fillfactor = (int) defGetInt64(&kwds[0]);
|
||||
else
|
||||
fillfactor = defaultFillfactor;
|
||||
if (fillfactor < minFillfactor || 100 < fillfactor)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("fillfactor=%d should be between %d and 100",
|
||||
fillfactor, minFillfactor)));
|
||||
|
||||
/*
|
||||
* build options
|
||||
*/
|
||||
result = (IndexOption *)
|
||||
MemoryContextAlloc(CacheMemoryContext, sizeof(IndexOption));
|
||||
VARATT_SIZEP(result) = sizeof(IndexOption);
|
||||
result->fillfactor = fillfactor;
|
||||
return (bytea *) result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user