Add checks for UNION target fields, and add optional TABLE to LOCK
and SELECT manual pages and psql help.
This commit is contained in:
parent
94abcc1665
commit
c530fbfb2f
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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)
|
if (unionClause)
|
||||||
{
|
{
|
||||||
|
/* recursion */
|
||||||
qlist = parse_analyze(unionClause, NULL);
|
qlist = parse_analyze(unionClause, NULL);
|
||||||
|
|
||||||
for (i = 0; i < qlist->len; i++)
|
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]);
|
union_list = lappend(union_list, qlist->qtrees[i]);
|
||||||
/* we need to check return types are consistent here */
|
}
|
||||||
return union_list;
|
return union_list;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: psqlHelp.h,v 1.40 1998/02/03 19:27:00 momjian Exp $
|
* $Id: psqlHelp.h,v 1.41 1998/03/18 15:48:26 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -252,7 +252,7 @@ static struct _helpStruct QL_HELP[] = {
|
||||||
"load <filename>;"},
|
"load <filename>;"},
|
||||||
{"lock",
|
{"lock",
|
||||||
"exclusive lock a table inside a transaction",
|
"exclusive lock a table inside a transaction",
|
||||||
"lock <class_name>;"},
|
"lock [table] <class_name>;"},
|
||||||
{"move",
|
{"move",
|
||||||
"move an cursor position",
|
"move an cursor position",
|
||||||
"move [forward|backward] [<number>|all] [in <cursorname>];"},
|
"move [forward|backward] [<number>|all] [in <cursorname>];"},
|
||||||
|
@ -273,7 +273,7 @@ static struct _helpStruct QL_HELP[] = {
|
||||||
{"select",
|
{"select",
|
||||||
"retrieve tuples",
|
"retrieve tuples",
|
||||||
"select [distinct on <attr>] <expr1> [as <attr1>], ... <exprN> [as <attrN>]\n\
|
"select [distinct on <attr>] <expr1> [as <attr1>], ... <exprN> [as <attrN>]\n\
|
||||||
\t[into table <class_name>]\n\
|
\t[into [table] <class_name>]\n\
|
||||||
\t[from <from_list>]\n\
|
\t[from <from_list>]\n\
|
||||||
\t[where <qual>]\n\
|
\t[where <qual>]\n\
|
||||||
\t[group by <group_list>]\n\
|
\t[group by <group_list>]\n\
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
.\" This is -*-nroff-*-
|
.\" This is -*-nroff-*-
|
||||||
.\" XXX standard disclaimer belongs here....
|
.\" XXX standard disclaimer belongs here....
|
||||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/lock.l,v 1.3 1998/01/28 20:44:42 momjian Exp $
|
.\" $Header: /cvsroot/pgsql/src/man/Attic/lock.l,v 1.4 1998/03/18 15:48:57 momjian Exp $
|
||||||
.TH FETCH SQL 01/23/93 PostgreSQL PostgreSQL
|
.TH FETCH SQL 01/23/93 PostgreSQL PostgreSQL
|
||||||
.SH NAME
|
.SH NAME
|
||||||
lock - exclusive lock a table
|
lock - exclusive lock a table
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.nf
|
.nf
|
||||||
\fBlock\fR classname
|
\fBlock\fR [\fBtable\fR] classname
|
||||||
.fi
|
.fi
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.BR lock
|
.BR lock
|
||||||
|
@ -31,7 +31,7 @@ aquisitions and requests to not form a deadlock.
|
||||||
-- Proper locking to prevent deadlock
|
-- Proper locking to prevent deadlock
|
||||||
--
|
--
|
||||||
begin work;
|
begin work;
|
||||||
lock mytable;
|
lock table mytable;
|
||||||
select * from mytable;
|
select * from mytable;
|
||||||
update mytable set (x = 100);
|
update mytable set (x = 100);
|
||||||
end work;
|
end work;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.\" This is -*-nroff-*-
|
.\" This is -*-nroff-*-
|
||||||
.\" XXX standard disclaimer belongs here....
|
.\" XXX standard disclaimer belongs here....
|
||||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/select.l,v 1.4 1998/01/11 22:17:58 momjian Exp $
|
.\" $Header: /cvsroot/pgsql/src/man/Attic/select.l,v 1.5 1998/03/18 15:49:08 momjian Exp $
|
||||||
.TH SELECT SQL 11/05/95 PostgreSQL PostgreSQL
|
.TH SELECT SQL 11/05/95 PostgreSQL PostgreSQL
|
||||||
.SH NAME
|
.SH NAME
|
||||||
select - retrieve instances from a class
|
select - retrieve instances from a class
|
||||||
|
@ -9,7 +9,7 @@ select - retrieve instances from a class
|
||||||
\fBselect\fR [distinct]
|
\fBselect\fR [distinct]
|
||||||
expression1 [\fBas\fR attr_name-1]
|
expression1 [\fBas\fR attr_name-1]
|
||||||
{, expression-1 [\fBas\fR attr_name-i]}
|
{, expression-1 [\fBas\fR attr_name-i]}
|
||||||
[\fBinto\fR \fBtable\fR classname]
|
[\fBinto\fR [\fBtable\fR] classname]
|
||||||
[\fBfrom\fR from-list]
|
[\fBfrom\fR from-list]
|
||||||
[\fBwhere\fR where-clause]
|
[\fBwhere\fR where-clause]
|
||||||
[\fBgroup by\fR attr_name1 {, attr_name-i....}]
|
[\fBgroup by\fR attr_name1 {, attr_name-i....}]
|
||||||
|
|
Loading…
Reference in New Issue