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/12/27 02:41:11 UTC

[GitHub] [shardingsphere] theodoretsai opened a new issue, #23110: Performing unsupported query

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

   ## Question
   
   I need to manually control locks in PostgreSQL, but running them with a sharded connection will produce org.apache.shardingsphere.sql.parser.exception.SQLParsingException: Unsupported SQL, is there a way to manually route such queries and work around the problem?
   
   SQLs I need to run are like:
   ```
   NOWAIT_SQL = lock table %1$s in access share mode nowait;
   ```
   
   ```
   PreparedStatement lockSm = connectionCache.prepareStatement(
                           String.format(NOWAIT_SELECT_SQL, table),
                           ResultSet.TYPE_FORWARD_ONLY,
                           ResultSet.CONCUR_READ_ONLY);
   PreparedStatement sm = connectionCache.prepareStatement(
                           "select * from " + table + ";",
                           ResultSet.TYPE_FORWARD_ONLY,
                           ResultSet.CONCUR_READ_ONLY);
   connection.setAutoCommit(false);
   lockSm.execute();
   rs = sm.executeQuery();
   ...
   connectionCache.commit();
   connectionCache.setAutoCommit(true);
   ```


-- 
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] theodoretsai commented on issue #23110: Performing unsupported query

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

   I should have used ? as placeholder for tablename, sorry.
   That was the prototype code for testing, so I was just using String format to inject parameters into the sql, %1$s should be replaced by a table name you intend to lock.


-- 
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] theodoretsai commented on issue #23110: Performing unsupported query

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

   Thanks, I was using version 4.0.1, will try 5.3.0. But in a more generic case I suppose there is no way to bypass the parser if needed?


-- 
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] TeslaCN closed issue #23110: Performing unsupported query

Posted by GitBox <gi...@apache.org>.
TeslaCN closed issue #23110: Performing unsupported query
URL: https://github.com/apache/shardingsphere/issues/23110


-- 
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] TeslaCN commented on issue #23110: Performing unsupported query

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

   > Thanks, I was using version 4.0.1, will try 5.3.0. But in a more generic case I suppose there is no way to bypass the parser if needed?
   
   There is no such way for now.


-- 
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] TeslaCN commented on issue #23110: Performing unsupported query

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

   I can't execute this SQL in PostgreSQL 14. Could you clarify?
   
   ![image](https://user-images.githubusercontent.com/20503072/209772436-8fb6f57b-f338-4a8a-a364-d96cbfa23a09.png)
   


-- 
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] TeslaCN commented on issue #23110: Performing unsupported query

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

   It seems that the SQL is supported by ShardingSphere's Parser.
   ![image](https://user-images.githubusercontent.com/20503072/209773406-1bb51f45-8961-4e43-b4be-0dff1539c3f7.png)
   


-- 
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] TeslaCN commented on issue #23110: Performing unsupported query

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

   Could you try the ShardingSphere 5.3.0?
   I tried executing SQL in ShardingSphere-Proxy PostgreSQL. The SQL could be parsed and executed.
   ![image](https://user-images.githubusercontent.com/20503072/209773144-59998b91-c2b4-4a33-831b-0422c0471cd7.png)
   


-- 
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