Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 05cdb99

Browse files
author
Thomas G. Lockhart
committed
Add detection and warnings for UNION and HAVING clauses.
Generate non-fatal warning only and proceed by ignoring clauses.
1 parent 05eb632 commit 05cdb99

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/backend/parser/analyze.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.35 1997/08/22 00:02:04 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.36 1997/09/01 05:56:34 thomas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -429,6 +429,14 @@ transformSelectStmt(ParseState *pstate, RetrieveStmt *stmt)
429429
/* fix where clause */
430430
qry->qual = transformWhereClause(pstate,stmt->whereClause);
431431

432+
/* check subselect clause */
433+
if (stmt->selectClause)
434+
elog(NOTICE,"UNION not yet supported; using first SELECT only",NULL);
435+
436+
/* check subselect clause */
437+
if (stmt->havingClause)
438+
elog(NOTICE,"HAVING not yet supported; ignore clause",NULL);
439+
432440
/* fix order clause */
433441
qry->sortClause = transformSortClause(pstate,
434442
stmt->sortClause,
@@ -1494,6 +1502,11 @@ find_targetlist_entry(ParseState *pstate, SortGroupBy *sortgroupby, List *tlist)
14941502
char *resname = resnode->resname;
14951503
int test_rtable_pos = var->varno;
14961504

1505+
#ifdef PARSEDEBUG
1506+
printf("find_targetlist_entry- target name is %s, position %d, resno %d\n",
1507+
(sortgroupby->name? sortgroupby->name: "(null)"), target_pos+1, sortgroupby->resno);
1508+
#endif
1509+
14971510
if (!sortgroupby->name) {
14981511
if (sortgroupby->resno == ++target_pos) {
14991512
target_result = target;
@@ -1534,7 +1547,7 @@ any_ordering_op(int restype)
15341547

15351548
/*
15361549
* transformGroupClause -
1537-
* transform an Group By clause
1550+
* transform a Group By clause
15381551
*
15391552
*/
15401553
static List *

0 commit comments

Comments
 (0)