1
0
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:
Bruce Momjian
1998-03-18 15:49:08 +00:00
parent 94abcc1665
commit c530fbfb2f
4 changed files with 25 additions and 10 deletions

View File

@ -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