diff options
author | Neil Conway <neilc@samurai.com> | 2005-04-07 01:51:41 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2005-04-07 01:51:41 +0000 |
commit | f5ab0a14ea83eb6c27196b0c5d600b7f8b8b75fc (patch) | |
tree | 3a40f9e70af0338c3dd1210b859f1a7445a40e6c /src/backend/parser/parse_relation.c | |
parent | be2f825d51176bd21a627a529476f94de5bad4c2 (diff) | |
download | postgresql-f5ab0a14ea83eb6c27196b0c5d600b7f8b8b75fc.tar.gz postgresql-f5ab0a14ea83eb6c27196b0c5d600b7f8b8b75fc.zip |
Add a "USING" clause to DELETE, which is equivalent to the FROM clause
in UPDATE. We also now issue a NOTICE if a query has _any_ implicit
range table entries -- in the past, we would only warn about implicit
RTEs in SELECTs with at least one explicit RTE.
As a result of the warning change, 25 of the regression tests had to
be updated. I also took the opportunity to remove some bogus whitespace
differences between some of the float4 and float8 variants. I believe
I have correctly updated all the platform-specific variants, but let
me know if that's not the case.
Original patch for DELETE ... USING from Euler Taveira de Oliveira,
reworked by Neil Conway.
Diffstat (limited to 'src/backend/parser/parse_relation.c')
-rw-r--r-- | src/backend/parser/parse_relation.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c index 031bfa8fe24..edd59917e93 100644 --- a/src/backend/parser/parse_relation.c +++ b/src/backend/parser/parse_relation.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.104 2005/04/06 16:34:06 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.105 2005/04/07 01:51:39 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -596,6 +596,7 @@ colNameToVar(ParseState *pstate, char *colname, bool localonly) RangeTblEntry *rte = rt_fetch(varno, pstate->p_rtable); /* joins are always inFromCl, so no need to check */ + Assert(rte->inFromCl); /* use orig_pstate here to get the right sublevels_up */ newresult = scanRTEForColumn(orig_pstate, rte, colname); @@ -1966,17 +1967,12 @@ attnumTypeId(Relation rd, int attid) /* * Generate a warning or error about an implicit RTE, if appropriate. * - * If ADD_MISSING_FROM is not enabled, raise an error. - * - * Our current theory on warnings is that we should allow "SELECT foo.*" - * but warn about a mixture of explicit and implicit RTEs. + * If ADD_MISSING_FROM is not enabled, raise an error. Otherwise, emit + * a warning. */ static void warnAutoRange(ParseState *pstate, RangeVar *relation) { - bool foundInFromCl = false; - ListCell *temp; - if (!add_missing_from) { if (pstate->parentParseState != NULL) @@ -1990,19 +1986,9 @@ warnAutoRange(ParseState *pstate, RangeVar *relation) errmsg("missing FROM-clause entry for table \"%s\"", relation->relname))); } - - foreach(temp, pstate->p_rtable) - { - RangeTblEntry *rte = lfirst(temp); - - if (rte->inFromCl) - { - foundInFromCl = true; - break; - } - } - if (foundInFromCl) + else { + /* just issue a warning */ if (pstate->parentParseState != NULL) ereport(NOTICE, (errcode(ERRCODE_UNDEFINED_TABLE), |