From 556ca28beebdf8c35305e67dd5101f47392c31ae Mon Sep 17 00:00:00 2001 From: slguan Date: Thu, 22 Aug 2019 16:11:53 +0800 Subject: [PATCH] fix issue #156 --- src/inc/sql.y | 4 ++-- src/util/src/sql.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/inc/sql.y b/src/inc/sql.y index 8d8709d085..bf3c184a0f 100755 --- a/src/inc/sql.y +++ b/src/inc/sql.y @@ -408,7 +408,7 @@ limit_opt(A) ::= LIMIT signed(X). {A.limit = X; A.offset = 0;} limit_opt(A) ::= LIMIT signed(X) OFFSET signed(Y). {A.limit = X; A.offset = Y;} limit_opt(A) ::= LIMIT signed(X) COMMA signed(Y). - {A.limit = X; A.offset = Y;} + {A.limit = Y; A.offset = X;} %type slimit_opt {SLimitVal} slimit_opt(A) ::= . {A.limit = -1; A.offset = 0;} @@ -416,7 +416,7 @@ slimit_opt(A) ::= SLIMIT signed(X). {A.limit = X; A.offset = 0;} slimit_opt(A) ::= SLIMIT signed(X) SOFFSET signed(Y). {A.limit = X; A.offset = Y;} slimit_opt(A) ::= SLIMIT signed(X) COMMA signed(Y). - {A.limit = X; A.offset = Y;} + {A.limit = Y; A.offset = X;} %type where_opt {tSQLExpr*} %destructor where_opt {tSQLExprDestroy($$);} diff --git a/src/util/src/sql.c b/src/util/src/sql.c index 4a91773d12..b402c85ca9 100644 --- a/src/util/src/sql.c +++ b/src/util/src/sql.c @@ -1892,11 +1892,13 @@ static void yy_reduce( {yygotominor.yy294.limit = yymsp[0].minor.yy189; yygotominor.yy294.offset = 0;} break; case 122: /* limit_opt ::= LIMIT signed OFFSET signed */ - case 123: /* limit_opt ::= LIMIT signed COMMA signed */ yytestcase(yyruleno==123); case 126: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ yytestcase(yyruleno==126); - case 127: /* slimit_opt ::= SLIMIT signed COMMA signed */ yytestcase(yyruleno==127); {yygotominor.yy294.limit = yymsp[-2].minor.yy189; yygotominor.yy294.offset = yymsp[0].minor.yy189;} break; + case 123: /* limit_opt ::= LIMIT signed COMMA signed */ + case 127: /* slimit_opt ::= SLIMIT signed COMMA signed */ yytestcase(yyruleno==127); +{yygotominor.yy294.limit = yymsp[0].minor.yy189; yygotominor.yy294.offset = yymsp[-2].minor.yy189;} + break; case 130: /* expr ::= LP expr RP */ {yygotominor.yy370 = yymsp[-1].minor.yy370; } break; -- GitLab