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

Commitce62c8b

Browse files
Jan WieckJan Wieck
Jan Wieck
authored and
Jan Wieck
committed
Patch from Ian Lance Taylor fixing multiple cursor arguments
and buffer zero termination.Jan
1 parent1173344 commitce62c8b

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

‎src/pl/plpgsql/src/gram.y

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* procedural language
55
*
66
* IDENTIFICATION
7-
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/gram.y,v 1.20 2001/05/31 17:15:40 momjian Exp $
7+
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/gram.y,v 1.21 2001/06/06 18:54:41 wieck Exp $
88
*
99
* This software is copyrighted by Jan Wieck - Hamburg.
1010
*
@@ -385,7 +385,8 @@ decl_statement: decl_varname decl_const decl_datatype decl_notnull decl_defval
385385
*cp2++ ='\\';
386386
*cp2++ = *cp1++;
387387
}
388-
strcat(buf,"'");
388+
*cp2++ ='\'';
389+
*cp2 ='\0';
389390
curname_def->query = strdup(buf);
390391
new->default_val = curname_def;
391392

@@ -1404,6 +1405,8 @@ stmt_open: K_OPEN lno cursor_varptr
14041405
{
14051406
if ($3->cursor_explicit_argrow >=0)
14061407
{
1408+
char *cp;
1409+
14071410
tok =yylex();
14081411

14091412
if (tok !='(')
@@ -1412,7 +1415,20 @@ stmt_open: K_OPEN lno cursor_varptr
14121415
elog(ERROR,"cursor %s has arguments", $3->refname);
14131416
}
14141417

1415-
new->argquery = read_sqlstmt(';',";","SELECT (");
1418+
new->argquery = read_sqlstmt(';',";","SELECT");
1419+
/* Remove the trailing right paren,
1420+
* because we want "select 1, 2", not
1421+
* "select (1, 2)".
1422+
*/
1423+
cp =new->argquery->query;
1424+
cp += strlen(cp);
1425+
--cp;
1426+
if (*cp !=')')
1427+
{
1428+
plpgsql_comperrinfo();
1429+
elog(ERROR,"missing )");
1430+
}
1431+
*cp ='\0';
14161432
}
14171433
else
14181434
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp