From b105324f7e8632c8f392f2f977c43d2d695539d3 Mon Sep 17 00:00:00 2001 From: "Thomas G. Lockhart" Date: Fri, 26 Sep 1997 15:09:11 +0000 Subject: [PATCH] Fix SUBSTRING(str FROM int TO int) parsing. --- src/backend/parser/gram.y | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index d8822bdebc..90afc5349a 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.51 1997/09/25 14:11:42 thomas Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.52 1997/09/26 15:09:11 thomas Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -2938,9 +2938,7 @@ position_expr: attr opt_indirection substr_list: expr_list substr_from substr_for { - $$ = $1; - if ($2 != NULL) $$ = lappend($$, $2); - if ($3 != NULL) $$ = lappend($$, $3); + $$ = nconc(nconc($1,$2),$3); } | /* EMPTY */ { $$ = NIL; } @@ -2949,7 +2947,12 @@ substr_list: expr_list substr_from substr_for substr_from: FROM expr_list { $$ = $2; } | /* EMPTY */ - { $$ = NIL; } + { + A_Const *n = makeNode(A_Const); + n->val.type = T_Integer; + n->val.val.ival = 1; + $$ = lcons((Node *)n,NIL); + } ; substr_for: FOR expr_list