mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Add checks for UNION target fields, and add optional TABLE to LOCK
and SELECT manual pages and psql help.
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.13 1998/02/26 04:33:29 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.14 1998/03/18 15:47:51 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -382,11 +382,26 @@ transformUnionClause(List *unionClause, List *targetlist)
|
||||
|
||||
if (unionClause)
|
||||
{
|
||||
/* recursion */
|
||||
qlist = parse_analyze(unionClause, NULL);
|
||||
|
||||
for (i = 0; i < qlist->len; i++)
|
||||
{
|
||||
List *prev_target = targetlist;
|
||||
List *next_target;
|
||||
|
||||
if (length(targetlist) != length(qlist->qtrees[i]->targetList))
|
||||
elog(ERROR,"Each UNION query must have the same number of columns.");
|
||||
|
||||
foreach(next_target, qlist->qtrees[i]->targetList)
|
||||
{
|
||||
if (((TargetEntry *)lfirst(prev_target))->resdom->restype !=
|
||||
((TargetEntry *)lfirst(next_target))->resdom->restype)
|
||||
elog(ERROR,"Each UNION query must have identical target types.");
|
||||
prev_target = lnext(prev_target);
|
||||
}
|
||||
union_list = lappend(union_list, qlist->qtrees[i]);
|
||||
/* we need to check return types are consistent here */
|
||||
}
|
||||
return union_list;
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user