From 05e3d0ee8666b74f11ffad16f46e372459d6e53e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 5 Oct 2000 19:11:39 +0000 Subject: Reimplementation of UNION/INTERSECT/EXCEPT. INTERSECT/EXCEPT now meet the SQL92 semantics, including support for ALL option. All three can be used in subqueries and views. DISTINCT and ORDER BY work now in views, too. This rewrite fixes many problems with cross-datatype UNIONs and INSERT/SELECT where the SELECT yields different datatypes than the INSERT needs. I did that by making UNION subqueries and SELECT in INSERT be treated like subselects-in-FROM, thereby allowing an extra level of targetlist where the datatype conversions can be inserted safely. INITDB NEEDED! --- src/include/parser/analyze.h | 5 +---- src/include/parser/parse_coerce.h | 7 ++++++- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/include/parser') diff --git a/src/include/parser/analyze.h b/src/include/parser/analyze.h index 691ec92c1fc..afd8a34fb3e 100644 --- a/src/include/parser/analyze.h +++ b/src/include/parser/analyze.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: analyze.h,v 1.10 2000/01/26 05:58:26 momjian Exp $ + * $Id: analyze.h,v 1.11 2000/10/05 19:11:38 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,4 @@ extern List *parse_analyze(List *pl, ParseState *parentParseState); -extern void create_select_list(Node *ptr, List **select_list, bool *unionall_present); -extern Node *A_Expr_to_Expr(Node *ptr, bool *intersect_present); - #endif /* ANALYZE_H */ diff --git a/src/include/parser/parse_coerce.h b/src/include/parser/parse_coerce.h index acea75d01df..7dd95f5b47c 100644 --- a/src/include/parser/parse_coerce.h +++ b/src/include/parser/parse_coerce.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: parse_coerce.h,v 1.23 2000/08/21 04:48:52 tgl Exp $ + * $Id: parse_coerce.h,v 1.24 2000/10/05 19:11:38 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -135,4 +135,9 @@ extern Node *coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, extern Node *coerce_type_typmod(ParseState *pstate, Node *node, Oid targetTypeId, int32 atttypmod); +extern Oid select_common_type(List *typeids, const char *context); +extern Node *coerce_to_common_type(ParseState *pstate, Node *node, + Oid targetTypeId, + const char *context); + #endif /* PARSE_COERCE_H */ -- cgit v1.2.3