Commit 240dc5cd authored by Bruce Momjian's avatar Bruce Momjian

Add add_missing_from GUC variable.

Nigel J. Andrews
parent 9ffdd91b
TODO list for PostgreSQL TODO list for PostgreSQL
======================== ========================
Last updated: Wed Jun 11 17:38:50 EDT 2003 Last updated: Wed Jun 11 18:09:42 EDT 2003
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us) Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.183 2003/06/11 18:01:13 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.184 2003/06/11 22:13:21 momjian Exp $
--> -->
<Chapter Id="runtime"> <Chapter Id="runtime">
...@@ -1299,6 +1299,22 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -1299,6 +1299,22 @@ SET ENABLE_SEQSCAN TO OFF;
<title>General Operation</title> <title>General Operation</title>
<variablelist> <variablelist>
<varlistentry>
<term><varname>ADD_MISSING_FROM</varname> (<type>boolean</type>)</term>
<listitem>
<para>
This parameter controls whether a relation referenced in a query but
missing from the FROM clause should be automatically added to
the FROM clause. If enabled (the default), the notice
<literal>Adding missing FROM-clause entry for table "tablename"</literal>
is generated if a relation is automatically added. If not enabled,
an error is raised when an additional extra relation is required.
For SQL standards compliance, this value should be set to
<literal>false</>.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><varname>AUSTRALIAN_TIMEZONES</varname> (<type>boolean</type>)</term> <term><varname>AUSTRALIAN_TIMEZONES</varname> (<type>boolean</type>)</term>
<indexterm><primary>Australian time zones</></> <indexterm><primary>Australian time zones</></>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.81 2003/04/29 22:13:10 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.82 2003/06/11 22:13:22 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include "utils/lsyscache.h" #include "utils/lsyscache.h"
#include "utils/syscache.h" #include "utils/syscache.h"
/* GUC parameter */
bool add_missing_from;
static Node *scanNameSpaceForRefname(ParseState *pstate, Node *nsnode, static Node *scanNameSpaceForRefname(ParseState *pstate, Node *nsnode,
const char *refname); const char *refname);
...@@ -1861,7 +1863,14 @@ warnAutoRange(ParseState *pstate, RangeVar *relation) ...@@ -1861,7 +1863,14 @@ warnAutoRange(ParseState *pstate, RangeVar *relation)
} }
} }
if (foundInFromCl) if (foundInFromCl)
elog(NOTICE, "Adding missing FROM-clause entry%s for table \"%s\"", {
pstate->parentParseState != NULL ? " in subquery" : "", if (add_missing_from)
relation->relname); elog(NOTICE, "Adding missing FROM-clause entry%s for table \"%s\"",
pstate->parentParseState != NULL ? " in subquery" : "",
relation->relname);
else
elog(ERROR, "Missing FROM-clause entry%s for table \"%s\"",
pstate->parentParseState != NULL ? " in subquery" : "",
relation->relname);
}
} }
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>. * Written by Peter Eisentraut <peter_e@gmx.net>.
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.130 2003/06/11 18:49:00 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.131 2003/06/11 22:13:22 momjian Exp $
* *
*-------------------------------------------------------------------- *--------------------------------------------------------------------
*/ */
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "optimizer/paths.h" #include "optimizer/paths.h"
#include "optimizer/prep.h" #include "optimizer/prep.h"
#include "parser/parse_expr.h" #include "parser/parse_expr.h"
#include "parser/parse_relation.h"
#include "storage/fd.h" #include "storage/fd.h"
#include "storage/freespace.h" #include "storage/freespace.h"
#include "storage/lock.h" #include "storage/lock.h"
...@@ -550,10 +551,15 @@ static struct config_bool ...@@ -550,10 +551,15 @@ static struct config_bool
{"transaction_read_only", PGC_USERSET, GUC_NO_RESET_ALL}, &XactReadOnly, {"transaction_read_only", PGC_USERSET, GUC_NO_RESET_ALL}, &XactReadOnly,
false, NULL, NULL false, NULL, NULL
}, },
{
{"add_missing_from", PGC_USERSET}, &add_missing_from,
true, NULL, NULL
},
/* End-of-list marker */
{ {
{NULL, 0}, NULL, false, NULL, NULL {NULL, 0}, NULL, false, NULL, NULL
} },
}; };
...@@ -742,6 +748,7 @@ static struct config_int ...@@ -742,6 +748,7 @@ static struct config_int
0, 0, INT_MAX / 1000, NULL, NULL 0, 0, INT_MAX / 1000, NULL, NULL
}, },
/* End-of-list marker */
{ {
{NULL, 0}, NULL, 0, 0, 0, NULL, NULL {NULL, 0}, NULL, 0, 0, 0, NULL, NULL
} }
...@@ -784,6 +791,7 @@ static struct config_real ...@@ -784,6 +791,7 @@ static struct config_real
0.5, 0.0, 1.0, assign_random_seed, show_random_seed 0.5, 0.0, 1.0, assign_random_seed, show_random_seed
}, },
/* End-of-list marker */
{ {
{NULL, 0}, NULL, 0.0, 0.0, 0.0, NULL, NULL {NULL, 0}, NULL, 0.0, 0.0, 0.0, NULL, NULL
} }
...@@ -946,6 +954,7 @@ static struct config_string ...@@ -946,6 +954,7 @@ static struct config_string
XLOG_sync_method_default, assign_xlog_sync_method, NULL XLOG_sync_method_default, assign_xlog_sync_method, NULL
}, },
/* End-of-list marker */
{ {
{NULL, 0}, NULL, NULL, NULL, NULL {NULL, 0}, NULL, NULL, NULL, NULL
} }
......
...@@ -208,3 +208,4 @@ ...@@ -208,3 +208,4 @@
#statement_timeout = 0 # 0 is disabled, in milliseconds #statement_timeout = 0 # 0 is disabled, in milliseconds
#db_user_namespace = false #db_user_namespace = false
#preload_libraries = '' #preload_libraries = ''
#add_missing_from = true
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright 2000-2002 by PostgreSQL Global Development Group * Copyright 2000-2002 by PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.78 2003/06/11 18:01:14 momjian Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.79 2003/06/11 22:13:22 momjian Exp $
*/ */
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
...@@ -492,6 +492,7 @@ psql_completion(char *text, int start, int end) ...@@ -492,6 +492,7 @@ psql_completion(char *text, int start, int end)
* the rest should match USERSET and possibly SUSET entries in * the rest should match USERSET and possibly SUSET entries in
* backend/utils/misc/guc.c. * backend/utils/misc/guc.c.
*/ */
"add_missing_from",
"australian_timezones", "australian_timezones",
"client_encoding", "client_encoding",
"client_min_messages", "client_min_messages",
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: parse_relation.h,v 1.39 2002/09/04 20:31:45 momjian Exp $ * $Id: parse_relation.h,v 1.40 2003/06/11 22:13:22 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include "parser/parse_node.h" #include "parser/parse_node.h"
extern bool add_missing_from;
extern RangeTblEntry *refnameRangeTblEntry(ParseState *pstate, extern RangeTblEntry *refnameRangeTblEntry(ParseState *pstate,
const char *schemaname, const char *schemaname,
const char *refname, const char *refname,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment