Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b105324

Browse files
author
Thomas G. Lockhart
committed
Fix SUBSTRING(str FROM int TO int) parsing.
1 parent 142d42f commit b105324

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/backend/parser/gram.y

+8-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.51 1997/09/25 14:11:42 thomas Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.52 1997/09/26 15:09:11 thomas Exp $
1414
*
1515
* HISTORY
1616
* AUTHOR DATE MAJOR EVENT
@@ -2938,9 +2938,7 @@ position_expr: attr opt_indirection
29382938

29392939
substr_list: expr_list substr_from substr_for
29402940
{
2941-
$$ = $1;
2942-
if ($2 != NULL) $$ = lappend($$, $2);
2943-
if ($3 != NULL) $$ = lappend($$, $3);
2941+
$$ = nconc(nconc($1,$2),$3);
29442942
}
29452943
| /* EMPTY */
29462944
{ $$ = NIL; }
@@ -2949,7 +2947,12 @@ substr_list: expr_list substr_from substr_for
29492947
substr_from: FROM expr_list
29502948
{ $$ = $2; }
29512949
| /* EMPTY */
2952-
{ $$ = NIL; }
2950+
{
2951+
A_Const *n = makeNode(A_Const);
2952+
n->val.type = T_Integer;
2953+
n->val.val.ival = 1;
2954+
$$ = lcons((Node *)n,NIL);
2955+
}
29532956
;
29542957

29552958
substr_for: FOR expr_list

0 commit comments

Comments
 (0)