1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +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:
Tom Lane
2006-07-03 22:45:41 +00:00
parent feed07350b
commit b7b78d24f7
57 changed files with 1128 additions and 1088 deletions

View File

@ -26,13 +26,14 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.272 2006/07/02 02:23:20 momjian Exp $
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.273 2006/07/03 22:45:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "access/heapam.h"
#include "access/reloptions.h"
#include "access/xlog.h"
#include "catalog/heap.h"
#include "catalog/namespace.h"
@ -45,8 +46,8 @@
#include "miscadmin.h"
#include "optimizer/clauses.h"
#include "optimizer/var.h"
#include "parser/parse_clause.h"
#include "parser/parsetree.h"
#include "parser/parse_clause.h"
#include "storage/smgr.h"
#include "utils/acl.h"
#include "utils/guc.h"
@ -543,7 +544,7 @@ InitPlan(QueryDesc *queryDesc, int eflags)
{
do_select_into = true;
estate->es_select_into = true;
estate->es_into_oids = parseTree->intoHasOids;
estate->es_into_oids = interpretOidsOption(parseTree->intoOptions);
}
/*
@ -727,10 +728,10 @@ InitPlan(QueryDesc *queryDesc, int eflags)
char *intoName;
Oid namespaceId;
Oid tablespaceId;
Datum reloptions;
AclResult aclresult;
Oid intoRelationId;
TupleDesc tupdesc;
ArrayType *options;
/*
* Check consistency of arguments
@ -770,6 +771,13 @@ InitPlan(QueryDesc *queryDesc, int eflags)
/* note InvalidOid is OK in this case */
}
/* Parse and validate any reloptions */
reloptions = transformRelOptions((Datum) 0,
parseTree->intoOptions,
true,
false);
(void) heap_reloptions(RELKIND_RELATION, reloptions, true);
/* Check permissions except when using the database's default */
if (OidIsValid(tablespaceId))
{
@ -788,7 +796,6 @@ InitPlan(QueryDesc *queryDesc, int eflags)
*/
tupdesc = CreateTupleDescCopy(tupType);
options = OptionBuild(NULL, parseTree->intoOptions);
intoRelationId = heap_create_with_catalog(intoName,
namespaceId,
tablespaceId,
@ -800,10 +807,8 @@ InitPlan(QueryDesc *queryDesc, int eflags)
true,
0,
parseTree->intoOnCommit,
allowSystemTableMods,
options);
if (options)
pfree(options);
reloptions,
allowSystemTableMods);
FreeTupleDesc(tupdesc);