From 01ecb2e3a03195c65d1ea55bfc9b4a47f632baec Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Mon, 30 Mar 1998 19:05:10 +0000
Subject: [PATCH] documentation for HAVING, clean up UNION comment.

---
 src/backend/optimizer/prep/prepunion.c | 26 +++++++++++++++++++++-----
 src/bin/psql/psqlHelp.h                |  5 ++++-
 src/man/select.l                       |  3 ++-
 3 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c
index 7b36d3b8e8c..e821f20a963 100644
--- a/src/backend/optimizer/prep/prepunion.c
+++ b/src/backend/optimizer/prep/prepunion.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.20 1998/02/26 04:33:05 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.21 1998/03/30 19:04:41 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -71,7 +71,8 @@ plan_union_queries(Query *parse)
 				union_found = false,
 				last_unionall_flag = false;
 
-	/*
+	/*------------------------------------------------------------------
+	 *
 	 * Do we need to split up our unions because we have UNION and UNION
 	 * ALL?
 	 *
@@ -87,10 +88,25 @@ plan_union_queries(Query *parse)
 	 *
 	 * So the above query becomes:
 	 *
-	 * Append Node { Sort and Unique { Append Node { SELECT 1
-	 * This is really a sub-UNION, unionClause			   We run a
-	 * DISTINCT on these. { SELECT 2 SELECT 3 } } } SELECT 4 SELECT 5 }
+	 * 	Append Node
+	 *	{
+	 *		Sort and Unique
+	 *		{
+	 *			Append Node
+	 *			{
+	 *				SELECT 1		This is really a sub-UNION.
+	 *				unionClause		We run a DISTINCT on these.
+	 *				{
+	 *					SELECT 2
+	 *					SELECT 3
+	 *				}
+	 *			}
+	 *		}
+	 *		SELECT 4
+	 *		SELECT 5
+	 *	}
 	 *
+	 *---------------------------------------------------------------------
 	 */
 
 	foreach(ulist, parse->unionClause)
diff --git a/src/bin/psql/psqlHelp.h b/src/bin/psql/psqlHelp.h
index 9c444f490c7..166e6009800 100644
--- a/src/bin/psql/psqlHelp.h
+++ b/src/bin/psql/psqlHelp.h
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: psqlHelp.h,v 1.41 1998/03/18 15:48:26 momjian Exp $
+ * $Id: psqlHelp.h,v 1.42 1998/03/30 19:04:53 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -163,6 +163,7 @@ static struct _helpStruct QL_HELP[] = {
 \t[from <from_list>]\n\
 \t[where <qual>]\n\
 \t[group by <group_list>]\n\
+\t[having <having_clause>]\n\
 \t[order by <attr1> [using <op1>],... <attrN> [using <opN>]]\n\
 \t[union [all] select ...];"},
 	{"delete",
@@ -243,6 +244,7 @@ static struct _helpStruct QL_HELP[] = {
 \t[from <from_clause>]\n\
 \t[where <qual>]\n\
 \t[group by <group_list>]\n\
+\t[having <having_clause>]\n\
 \t[union [all] select ...];"},
 	{"listen",
 		"listen for notification on a relation",
@@ -277,6 +279,7 @@ static struct _helpStruct QL_HELP[] = {
 \t[from <from_list>]\n\
 \t[where <qual>]\n\
 \t[group by <group_list>]\n\
+\t[having <having_clause>]\n\
 \t[order by <attr1> [ASC | DESC] [using <op1>], ... <attrN> ]\n\
 \t[union [all] select ...];"},
 	{"set",
diff --git a/src/man/select.l b/src/man/select.l
index 739e23c13d0..7fa3f5607e6 100644
--- a/src/man/select.l
+++ b/src/man/select.l
@@ -1,6 +1,6 @@
 .\" This is -*-nroff-*-
 .\" XXX standard disclaimer belongs here....
-.\" $Header: /cvsroot/pgsql/src/man/Attic/select.l,v 1.5 1998/03/18 15:49:08 momjian Exp $
+.\" $Header: /cvsroot/pgsql/src/man/Attic/select.l,v 1.6 1998/03/30 19:05:10 momjian Exp $
 .TH SELECT SQL 11/05/95 PostgreSQL PostgreSQL
 .SH NAME
 select - retrieve instances from a class
@@ -13,6 +13,7 @@ select - retrieve instances from a class
     [\fBfrom\fR from-list]
     [\fBwhere\fR where-clause]    
     [\fBgroup by\fR attr_name1 {, attr_name-i....}]
+    [\fBhaving\fR having-clause]
     [\fBorder by\fR attr_name1 [\fBasc\fR | \fBdesc\fR] [\fBusing op1\fR] {, attr_namei...}]
 [\fBunion {all} select\fR ...]
 
-- 
GitLab