You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/06/20 03:17:46 UTC

[GitHub] [shardingsphere] peilinqian opened a new issue, #18433: “fetch from cursor1”syntax is not supported

peilinqian opened a new issue, #18433:
URL: https://github.com/apache/shardingsphere/issues/18433

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   we find java version: java8, full_version=1.8.0_282
   ShardingSphere-5.1.2-SNAPSHOT
   Commit ID: 952c1feacb26bc03ea4ea14d9f82b0d5777732c2
   Commit Message: Update shasum arguments in Release documents (#18344)
   Branch: master
   Build time: 2022-06-13T19:07:26+0000
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   
   ### Expected behavior
   fetch from cursor1; succeed
   
   ### Actual behavior
   order_db=> cursor cursor1 for select * from cur_test_01 order by 1;
   order_db=> fetch from cursor1;
   ERROR:  You have an error in your SQL syntax
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   drop table if exists cur_test_01;
   create table cur_test_01(c_id int,c_num int,c_name varchar(10),c_city varchar(10),c_add varchar(20));
   insert into cur_test_01 values(1,18,'Allen','Beijing','AAAAABAAAAA'),(2,368,'Bob','Shanghai','AAAAACAAAAA'),
                              (3,59,'Cathy','Shenzhen','AAAAADAAAAA'),(4,96,'David','Suzhou','AAAAAEAAAAA'),
                              (5,17,'Edrwd','Fenghuang','AAAAAFAAAAA'),(6,253,'Fendi','Changsha','AAAAAGAAAAA');
   start transaction;
   cursor cursor1 for select * from cur_test_01 order by 1;
   fetch from cursor1;
   close cursor1;
   end;
   
   ### Example codes for reproduce this issue (such as a github link).
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] tuichenchuxin closed issue #18433: “fetch from cursor1”syntax is not supported

Posted by GitBox <gi...@apache.org>.
tuichenchuxin closed issue #18433: “fetch from cursor1”syntax is not supported
URL: https://github.com/apache/shardingsphere/issues/18433


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on issue #18433: “fetch from cursor1”syntax is not supported

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #18433:
URL: https://github.com/apache/shardingsphere/issues/18433#issuecomment-1159925746

   @peilinqian Thank you for your feedback. I found that the syntax description in the [openGauss documentation](https://opengauss.org/zh/docs/1.0.1/docs/Developerguide/FETCH.html) is wrong, it is inconsistent with the logic in the openGauss source code.
   
   Following is openGuass fetch syntax in official document.
   
   ```sql
   FETCH [ direction { FROM | IN } ] cursor_name;
   ```
   
   However, the real openGauss syntax is implemented as follows, the user can use the FROM | IN parameter without specifying the direction.
   
   ```
   /*****************************************************************************
    *
    *		QUERY:
    *			fetch/move
    *
    *****************************************************************************/
   
   FetchStmt:	FETCH fetch_args
   				{
   					FetchStmt *n = (FetchStmt *) $2;
   					n->ismove = FALSE;
   					$$ = (Node *)n;
   				}
   			| MOVE fetch_args
   				{
   					FetchStmt *n = (FetchStmt *) $2;
   					n->ismove = TRUE;
   					$$ = (Node *)n;
   				}
   		;
   
   fetch_args:	cursor_name
   				{
   					FetchStmt *n = makeNode(FetchStmt);
   					n->portalname = $1;
   					n->direction = FETCH_FORWARD;
   					n->howMany = 1;
   					$$ = (Node *)n;
   				}
   			| from_in cursor_name
   				{
   					FetchStmt *n = makeNode(FetchStmt);
   					n->portalname = $2;
   					n->direction = FETCH_FORWARD;
   					n->howMany = 1;
   					$$ = (Node *)n;
   				}
   			| NEXT opt_from_in cursor_name
   				{
   					FetchStmt *n = makeNode(FetchStmt);
   					n->portalname = $3;
   					n->direction = FETCH_FORWARD;
   					n->howMany = 1;
   					$$ = (Node *)n;
   				}
   			| PRIOR opt_from_in cursor_name
   				{
   					FetchStmt *n = makeNode(FetchStmt);
   					n->portalname = $3;
   					n->direction = FETCH_BACKWARD;
   					n->howMany = 1;
   					$$ = (Node *)n;
   				}
   			| FIRST_P opt_from_in cursor_name
   				{
   					FetchStmt *n = makeNode(FetchStmt);
   					n->portalname = $3;
   					n->direction = FETCH_ABSOLUTE;
   					n->howMany = 1;
   					$$ = (Node *)n;
   				}
   			| LAST_P opt_from_in cursor_name
   				{
   					FetchStmt *n = makeNode(FetchStmt);
   					n->portalname = $3;
   					n->direction = FETCH_ABSOLUTE;
   					n->howMany = -1;
   					$$ = (Node *)n;
   				}
   			| ABSOLUTE_P SignedIconst opt_from_in cursor_name
   				{
   					FetchStmt *n = makeNode(FetchStmt);
   					n->portalname = $4;
   					n->direction = FETCH_ABSOLUTE;
   					n->howMany = $2;
   					$$ = (Node *)n;
   				}
   			| RELATIVE_P SignedIconst opt_from_in cursor_name
   				{
   					FetchStmt *n = makeNode(FetchStmt);
   					n->portalname = $4;
   					n->direction = FETCH_RELATIVE;
   					n->howMany = $2;
   					$$ = (Node *)n;
   				}
   			| SignedIconst opt_from_in cursor_name
   				{
   					FetchStmt *n = makeNode(FetchStmt);
   					n->portalname = $3;
   					n->direction = FETCH_FORWARD;
   					n->howMany = $1;
   					$$ = (Node *)n;
   				}
   			| ALL opt_from_in cursor_name
   				{
   					FetchStmt *n = makeNode(FetchStmt);
   					n->portalname = $3;
   					n->direction = FETCH_FORWARD;
   					n->howMany = FETCH_ALL;
   					$$ = (Node *)n;
   				}
   			| FORWARD opt_from_in cursor_name
   				{
   					FetchStmt *n = makeNode(FetchStmt);
   					n->portalname = $3;
   					n->direction = FETCH_FORWARD;
   					n->howMany = 1;
   					$$ = (Node *)n;
   				}
   			| FORWARD SignedIconst opt_from_in cursor_name
   				{
   					FetchStmt *n = makeNode(FetchStmt);
   					n->portalname = $4;
   					n->direction = FETCH_FORWARD;
   					n->howMany = $2;
   					$$ = (Node *)n;
   				}
   			| FORWARD ALL opt_from_in cursor_name
   				{
   					FetchStmt *n = makeNode(FetchStmt);
   					n->portalname = $4;
   					n->direction = FETCH_FORWARD;
   					n->howMany = FETCH_ALL;
   					$$ = (Node *)n;
   				}
   			| BACKWARD opt_from_in cursor_name
   				{
   					FetchStmt *n = makeNode(FetchStmt);
   					n->portalname = $3;
   					n->direction = FETCH_BACKWARD;
   					n->howMany = 1;
   					$$ = (Node *)n;
   				}
   			| BACKWARD SignedIconst opt_from_in cursor_name
   				{
   					FetchStmt *n = makeNode(FetchStmt);
   					n->portalname = $4;
   					n->direction = FETCH_BACKWARD;
   					n->howMany = $2;
   					$$ = (Node *)n;
   				}
   			| BACKWARD ALL opt_from_in cursor_name
   				{
   					FetchStmt *n = makeNode(FetchStmt);
   					n->portalname = $4;
   					n->direction = FETCH_BACKWARD;
   					n->howMany = FETCH_ALL;
   					$$ = (Node *)n;
   				}
   		;
   
   from_in:	FROM									{}
   			| IN_P									{}
   		;
   
   opt_from_in:	from_in								{}
   			| /* EMPTY */							{}
   		;
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org