aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_clause.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-01-05 06:34:23 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-01-05 06:34:23 +0000
commit2fb6cc904555024ef668f5ba096b5bf0ddd3ec26 (patch)
tree267b9c28722477567b05001e1e37cf03afc7dc09 /src/backend/parser/parse_clause.c
parente62c38d0fccd16593ab2b126e97ea890ac646943 (diff)
downloadpostgresql-2fb6cc904555024ef668f5ba096b5bf0ddd3ec26.tar.gz
postgresql-2fb6cc904555024ef668f5ba096b5bf0ddd3ec26.zip
Remove not-really-standard implementation of CREATE TABLE's UNDER clause,
and revert documentation to describe the existing INHERITS clause instead, per recent discussion in pghackers. Also fix implementation of SQL_inheritance SET variable: it is not cool to look at this var during the initial parsing phase, only during parse_analyze(). See recent bug report concerning misinterpretation of date constants just after a SET TIMEZONE command. gram.y really has to be an invariant transformation of the query string to a raw parsetree; anything that can vary with time must be done during parse analysis.
Diffstat (limited to 'src/backend/parser/parse_clause.c')
-rw-r--r--src/backend/parser/parse_clause.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c
index c8f55c98e84..fb6b4e123cf 100644
--- a/src/backend/parser/parse_clause.c
+++ b/src/backend/parser/parse_clause.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.73 2000/11/16 22:30:27 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.74 2001/01/05 06:34:18 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,6 +29,8 @@
#include "parser/parse_relation.h"
#include "parser/parse_target.h"
#include "parser/parse_type.h"
+#include "utils/guc.h"
+
#define ORDER_CLAUSE 0
#define GROUP_CLAUSE 1
@@ -171,6 +173,29 @@ setTargetTable(ParseState *pstate, char *relname, bool inh, bool inJoinSet)
pstate->p_target_rangetblentry = rte;
}
+/*
+ * Simplify InhOption (yes/no/default) into boolean yes/no.
+ *
+ * The reason we do things this way is that we don't want to examine the
+ * SQL_inheritance option flag until parse_analyze is run. Otherwise,
+ * we'd do the wrong thing with query strings that intermix SET commands
+ * with queries.
+ */
+bool
+interpretInhOption(InhOption inhOpt)
+{
+ switch (inhOpt)
+ {
+ case INH_NO:
+ return false;
+ case INH_YES:
+ return true;
+ case INH_DEFAULT:
+ return SQL_inheritance;
+ }
+ elog(ERROR, "Bogus InhOption value");
+ return false; /* keep compiler quiet */
+}
/*
* Extract all not-in-common columns from column lists of a source table
@@ -355,7 +380,8 @@ transformTableEntry(ParseState *pstate, RangeVar *r)
* automatically generate the range variable if not specified. However
* there are times we need to know whether the entries are legitimate.
*/
- rte = addRangeTableEntry(pstate, relname, r->name, r->inh, true);
+ rte = addRangeTableEntry(pstate, relname, r->name,
+ interpretInhOption(r->inhOpt), true);
/*
* We create a RangeTblRef, but we do not add it to the joinlist here.