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 2020/05/22 02:33:23 UTC

[GitHub] [shardingsphere] liuqiankun93 opened a new issue #5743: sharding-jdbc parse sql java.lang.NullPointerException in postgresql

liuqiankun93 opened a new issue #5743:
URL: https://github.com/apache/shardingsphere/issues/5743


   dependency:
   `        <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>sharding-jdbc-core</artifactId>
               <version>4.1.0</version>
           </dependency>`
   
   My database is postgresql.
   
   I only ues jdbc to query database.
   
   when my sql is `select * from me`it will run success.
   
   But when my sql is
   
   `select uuid from me`
   
   or
   
   `select * from me where uuid = '15c2c185-9068-4db9-aad7-6c0d52713f28'`
   
   it will occur error.the error info:
   
   `line 1:25 no viable alternative at input 'uuid'
   line 1:25 mismatched input 'uuid' expecting {'U', 'u', '!', '~', '+', '-', '(', '{', '?', INSERT, UPDATE, DELETE, ALTER, DROP, TRUNCATE, SCHEMA, REVOKE, ADD, SET, INDEX, KEY, FUNCTION, TRIGGER, PROCEDURE, CASE, CAST, IF, NOT, NULL, TRUE, FALSE, EXISTS, BEGIN, COMMIT, ROLLBACK, SAVEPOINT, BOOLEAN, CHAR, INTERVAL, TIME, TIMESTAMP, LOCALTIME, LOCALTIMESTAMP, YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, MAX, MIN, SUM, COUNT, AVG, CURRENT, ENABLE, DISABLE, INSTANCE, PRESERVE, DEFINER, CURRENT_USER, SQL, CASCADED, LOCAL, CLOSE, OPEN, NEXT, NAME, NAMES, INTEGER, REAL, DECIMAL, TYPE, ADMIN, BINARY, ESCAPE, EXCLUDE, PARTITION, ROW, UNKNOWN, ALWAYS, CASCADE, GENERATED, ISOLATION, LEVEL, OPTION, PRIVILEGES, READ, ROLE, ROWS, START, TRANSACTION, ACTION, CACHE, CHARACTERISTICS, CLUSTER, COMMENTS, CONSTRAINTS, CURRENT_TIMESTAMP, CYCLE, DATA, DATABASE, DEFAULTS, DEFERRED, DEPENDS, DOMAIN, EXCLUDING, EXECUTE, EXTENDED, EXTENSION, EXTERNAL, EXTRACT, FILTER, FIRST, FOLLOWING, FORCE, GLOBAL, IDENTITY, IMMEDIATE, INCLUDING, INCREMENT, INDEXES, INHERIT, INHERITS, INCLUDE, LANGUAGE, LARGE, LAST, LOGGED, MAIN, MATCH, MAXVALUE, MINVALUE, NOTHING, NULLS, OBJECT, OIDS, OVER, OWNED, OWNER, PARTIAL, PLAIN, PRECEDING, RANGE, RENAME, REPLICA, RESET, RESTART, RESTRICT, ROUTINE, RULE, SECURITY, SEQUENCE, SESSION, SHOW, SIMPLE, STATISTICS, STORAGE, TABLESPACE, TEMP, TEMPORARY, UNBOUNDED, UNLOGGED, USAGE, VALID, VALIDATE, WITHIN, WITHOUT, ZONE, OF, GROUPS, RECURSIVE, INT2, INT4, INT8, FLOAT4, FLOAT8, MACADDR8, INT4RANGE, INT8RANGE, IDENTIFIER_, STRING_, NUMBER_, HEX_DIGIT_, BIT_NUM_}
   Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0
   	at java.util.Collections$EmptyList.get(Collections.java:4456)
   	at org.apache.shardingsphere.sql.parser.postgresql.visitor.PostgreSQLVisitor.visitExpr(PostgreSQLVisitor.java:247)
   	at org.apache.shardingsphere.sql.parser.postgresql.visitor.PostgreSQLVisitor.visitExpr(PostgreSQLVisitor.java:113)
   	at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$ExprContext.accept(PostgreSQLStatementParser.java:5384)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.postgresql.visitor.impl.PostgreSQLDMLVisitor.visitWhereClause(PostgreSQLDMLVisitor.java:486)
   	at org.apache.shardingsphere.sql.parser.postgresql.visitor.impl.PostgreSQLDMLVisitor.visitWhereClause(PostgreSQLDMLVisitor.java:112)
   	at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$WhereClauseContext.accept(PostgreSQLStatementParser.java:3257)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.postgresql.visitor.impl.PostgreSQLDMLVisitor.visitSelectClause(PostgreSQLDMLVisitor.java:271)
   	at org.apache.shardingsphere.sql.parser.postgresql.visitor.impl.PostgreSQLDMLVisitor.visitSelectClause(PostgreSQLDMLVisitor.java:112)
   	at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SelectClauseContext.accept(PostgreSQLStatementParser.java:1987)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.postgresql.visitor.impl.PostgreSQLDMLVisitor.visitUnionClause(PostgreSQLDMLVisitor.java:253)
   	at org.apache.shardingsphere.sql.parser.postgresql.visitor.impl.PostgreSQLDMLVisitor.visitUnionClause(PostgreSQLDMLVisitor.java:112)
   	at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$UnionClauseContext.accept(PostgreSQLStatementParser.java:1894)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.postgresql.visitor.impl.PostgreSQLDMLVisitor.visitSelect(PostgreSQLDMLVisitor.java:245)
   	at org.apache.shardingsphere.sql.parser.postgresql.visitor.impl.PostgreSQLDMLVisitor.visitSelect(PostgreSQLDMLVisitor.java:112)
   	at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SelectContext.accept(PostgreSQLStatementParser.java:1843)
   	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
   	at org.apache.shardingsphere.sql.parser.SQLParserEngine.parse0(SQLParserEngine.java:80)
   	at org.apache.shardingsphere.sql.parser.SQLParserEngine.parse(SQLParserEngine.java:61)
   	at org.apache.shardingsphere.underlying.route.DataNodeRouter.createRouteContext(DataNodeRouter.java:97)
   	at org.apache.shardingsphere.underlying.route.DataNodeRouter.executeRoute(DataNodeRouter.java:89)
   	at org.apache.shardingsphere.underlying.route.DataNodeRouter.route(DataNodeRouter.java:76)
   	at org.apache.shardingsphere.underlying.pluggble.prepare.PreparedQueryPrepareEngine.route(PreparedQueryPrepareEngine.java:54)
   	at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.executeRoute(BasePrepareEngine.java:96)
   	at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.prepare(BasePrepareEngine.java:83)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.prepare(ShardingPreparedStatement.java:183)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.executeQuery(ShardingPreparedStatement.java:116)
   	at com.example.demo.Main.main(Main.java:157)`


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

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



[GitHub] [shardingsphere] jingshanglu commented on issue #5743: sharding-jdbc parse sql java.lang.NullPointerException in postgresql

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


   > @jingshanglu if my table have a uuid column,how can i query this column or query other column by uuid = ‘’?Is there a way to escape?
   
   @liuqiankun93 This is a bug, i am checking.


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

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



[GitHub] [shardingsphere] jingshanglu edited a comment on issue #5743: sharding-jdbc parse sql java.lang.NullPointerException in postgresql

Posted by GitBox <gi...@apache.org>.
jingshanglu edited a comment on issue #5743:
URL: https://github.com/apache/shardingsphere/issues/5743#issuecomment-632590829


   > @jingshanglu if my table have a uuid column,how can i query this column or query other column by uuid = ‘’?Is there a way to escape?
   
   @liuqiankun93 I am checking.


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

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



[GitHub] [shardingsphere] kimmking commented on issue #5743: sharding-jdbc parse sql java.lang.NullPointerException in postgresql

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


   You can try
   >  select * from me where "uuid" = '15c2c185-9068-4db9-aad7-6c0d52713f28'


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

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



[GitHub] [shardingsphere] liuqiankun93 closed issue #5743: sharding-jdbc parse sql java.lang.NullPointerException in postgresql

Posted by GitBox <gi...@apache.org>.
liuqiankun93 closed issue #5743:
URL: https://github.com/apache/shardingsphere/issues/5743


   


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

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



[GitHub] [shardingsphere] jingshanglu edited a comment on issue #5743: sharding-jdbc parse sql java.lang.NullPointerException in postgresql

Posted by GitBox <gi...@apache.org>.
jingshanglu edited a comment on issue #5743:
URL: https://github.com/apache/shardingsphere/issues/5743#issuecomment-632590829


   > @jingshanglu if my table have a uuid column,how can i query this column or query other column by uuid = ‘’?Is there a way to escape?
   
   @liuqiankun93 New version will fix it.


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

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



[GitHub] [shardingsphere] jingshanglu removed a comment on issue #5743: sharding-jdbc parse sql java.lang.NullPointerException in postgresql

Posted by GitBox <gi...@apache.org>.
jingshanglu removed a comment on issue #5743:
URL: https://github.com/apache/shardingsphere/issues/5743#issuecomment-632586749


   @liuqiankun93 uuid is a keyword.


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

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



[GitHub] [shardingsphere] liuqiankun93 commented on issue #5743: sharding-jdbc parse sql java.lang.NullPointerException in postgresql

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


   > You can try
   > 
   > > select * from me where "uuid" = '15c2c185-9068-4db9-aad7-6c0d52713f28'
   
   Thank your for your help.It can works by double quotation ,Thanks.


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

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



[GitHub] [shardingsphere] liuqiankun93 commented on issue #5743: sharding-jdbc parse sql java.lang.NullPointerException in postgresql

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


   @jingshanglu if my table have a uuid column,how can i query this column or query other column by uuid = ‘’?Is there a way to escape?


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

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



[GitHub] [shardingsphere] jingshanglu commented on issue #5743: sharding-jdbc parse sql java.lang.NullPointerException in postgresql

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


   @liuqiankun93 uuid is a keyword.


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

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



[GitHub] [shardingsphere] jingshanglu edited a comment on issue #5743: sharding-jdbc parse sql java.lang.NullPointerException in postgresql

Posted by GitBox <gi...@apache.org>.
jingshanglu edited a comment on issue #5743:
URL: https://github.com/apache/shardingsphere/issues/5743#issuecomment-632590829


   > @jingshanglu if my table have a uuid column,how can i query this column or query other column by uuid = ‘’?Is there a way to escape?
   
   @liuqiankun93 I'm checking.


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

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