aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/analyze.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-05-23 21:41:14 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-05-23 21:41:14 +0000
commit505b5185fc37a53fbdcd27e26f163fb0c532d136 (patch)
treec4fd935f4f6f26ef6d6f6f99dfcbfef1fd986b10 /src/backend/parser/analyze.c
parent57455fc565ca72f7423eca35b8141d1e3ddb65e8 (diff)
downloadpostgresql-505b5185fc37a53fbdcd27e26f163fb0c532d136.tar.gz
postgresql-505b5185fc37a53fbdcd27e26f163fb0c532d136.zip
Detect case of invalid use of GROUP BY when there are no
aggregate functions, as in select a, b from foo group by a; The ungrouped reference to b is not kosher, but formerly we neglected to check this unless there was an aggregate function somewhere in the query.
Diffstat (limited to 'src/backend/parser/analyze.c')
-rw-r--r--src/backend/parser/analyze.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 23158f3751a..14c8150ff05 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: analyze.c,v 1.106 1999/05/17 17:03:27 momjian Exp $
+ * $Id: analyze.c,v 1.107 1999/05/23 21:41:14 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -373,7 +373,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
qry->uniqueFlag);
qry->hasAggs = pstate->p_hasAggs;
- if (pstate->p_hasAggs)
+ if (pstate->p_hasAggs || qry->groupClause)
parseCheckAggregates(pstate, qry);
/*
@@ -997,7 +997,7 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
qry->rtable = pstate->p_rtable;
qry->hasAggs = pstate->p_hasAggs;
- if (pstate->p_hasAggs)
+ if (pstate->p_hasAggs || qry->groupClause)
parseCheckAggregates(pstate, qry);
/*