File tree 1 file changed +19
-3
lines changed 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change 4
4
* procedural language
5
5
*
6
6
* 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 $
8
8
*
9
9
* This software is copyrighted by Jan Wieck - Hamburg.
10
10
*
@@ -385,7 +385,8 @@ decl_statement : decl_varname decl_const decl_datatype decl_notnull decl_defval
385
385
*cp2++ = ' \\ ' ;
386
386
*cp2++ = *cp1++;
387
387
}
388
- strcat (buf, " '" );
388
+ *cp2++ = ' \' ' ;
389
+ *cp2 = ' \0 ' ;
389
390
curname_def->query = strdup(buf);
390
391
new ->default_val = curname_def;
391
392
@@ -1404,6 +1405,8 @@ stmt_open : K_OPEN lno cursor_varptr
1404
1405
{
1405
1406
if ($3 ->cursor_explicit_argrow >= 0 )
1406
1407
{
1408
+ char *cp;
1409
+
1407
1410
tok = yylex ();
1408
1411
1409
1412
if (tok != ' (' )
@@ -1412,7 +1415,20 @@ stmt_open : K_OPEN lno cursor_varptr
1412
1415
elog (ERROR, " cursor %s has arguments" , $3 ->refname);
1413
1416
}
1414
1417
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 ' ;
1416
1432
}
1417
1433
else
1418
1434
{
You can’t perform that action at this time.
0 commit comments