Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc530fbf

Browse files
committed
Add checks for UNION target fields, and add optional TABLE to LOCK
and SELECT manual pages and psql help.
1 parent94abcc1 commitc530fbf

File tree

4 files changed

+25
-10
lines changed

4 files changed

+25
-10
lines changed

‎src/backend/parser/parse_clause.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.13 1998/02/26 04:33:29 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.14 1998/03/18 15:47:51 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -382,11 +382,26 @@ transformUnionClause(List *unionClause, List *targetlist)
382382

383383
if (unionClause)
384384
{
385+
/* recursion */
385386
qlist=parse_analyze(unionClause,NULL);
386387

387388
for (i=0;i<qlist->len;i++)
389+
{
390+
List*prev_target=targetlist;
391+
List*next_target;
392+
393+
if (length(targetlist)!=length(qlist->qtrees[i]->targetList))
394+
elog(ERROR,"Each UNION query must have the same number of columns.");
395+
396+
foreach(next_target,qlist->qtrees[i]->targetList)
397+
{
398+
if (((TargetEntry*)lfirst(prev_target))->resdom->restype!=
399+
((TargetEntry*)lfirst(next_target))->resdom->restype)
400+
elog(ERROR,"Each UNION query must have identical target types.");
401+
prev_target=lnext(prev_target);
402+
}
388403
union_list=lappend(union_list,qlist->qtrees[i]);
389-
/* we need to check return types are consistent here */
404+
}
390405
returnunion_list;
391406
}
392407
else

‎src/bin/psql/psqlHelp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Copyright (c) 1994, Regents of the University of California
77
*
8-
* $Id: psqlHelp.h,v 1.40 1998/02/03 19:27:00 momjian Exp $
8+
* $Id: psqlHelp.h,v 1.41 1998/03/18 15:48:26 momjian Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -252,7 +252,7 @@ static struct _helpStruct QL_HELP[] = {
252252
"load <filename>;"},
253253
{"lock",
254254
"exclusive lock a table inside a transaction",
255-
"lock <class_name>;"},
255+
"lock[table]<class_name>;"},
256256
{"move",
257257
"move an cursor position",
258258
"move [forward|backward] [<number>|all] [in <cursorname>];"},
@@ -273,7 +273,7 @@ static struct _helpStruct QL_HELP[] = {
273273
{"select",
274274
"retrieve tuples",
275275
"select [distinct on <attr>] <expr1> [as <attr1>], ... <exprN> [as <attrN>]\n\
276-
\t[into table <class_name>]\n\
276+
\t[into[table] <class_name>]\n\
277277
\t[from <from_list>]\n\
278278
\t[where <qual>]\n\
279279
\t[group by <group_list>]\n\

‎src/man/lock.l

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/lock.l,v 1.3 1998/01/28 20:44:42 momjian Exp $
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/lock.l,v 1.4 1998/03/18 15:48:57 momjian Exp $
44
.TH FETCH SQL 01/23/93 PostgreSQL PostgreSQL
55
.SH NAME
66
lock - exclusive lock a table
77
.SH SYNOPSIS
88
.nf
9-
\fBlock\fR classname
9+
\fBlock\fR[\fBtable\fR]classname
1010
.fi
1111
.SH DESCRIPTION
1212
.BR lock
@@ -31,7 +31,7 @@ aquisitions and requests to not form a deadlock.
3131
-- Proper locking to prevent deadlock
3232
--
3333
begin work;
34-
lock mytable;
34+
locktablemytable;
3535
select * from mytable;
3636
update mytable set (x = 100);
3737
end work;

‎src/man/select.l

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/select.l,v 1.4 1998/01/11 22:17:58 momjian Exp $
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/select.l,v 1.5 1998/03/18 15:49:08 momjian Exp $
44
.TH SELECT SQL 11/05/95 PostgreSQL PostgreSQL
55
.SH NAME
66
select - retrieve instances from a class
@@ -9,7 +9,7 @@ select - retrieve instances from a class
99
\fBselect\fR [distinct]
1010
expression1 [\fBas\fR attr_name-1]
1111
{, expression-1 [\fBas\fR attr_name-i]}
12-
[\fBinto\fR\fBtable\fR classname]
12+
[\fBinto\fR[\fBtable\fR] classname]
1313
[\fBfrom\fR from-list]
1414
[\fBwhere\fR where-clause]
1515
[\fBgroupby\fR attr_name1 {, attr_name-i....}]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp