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/01/15 12:52:54 UTC

[GitHub] [incubator-shardingsphere] encodeering opened a new issue #3990: Parse engine rejects CURRENT_USER in 4.0.0

encodeering opened a new issue #3990: Parse engine rejects CURRENT_USER in 4.0.0
URL: https://github.com/apache/incubator-shardingsphere/issues/3990
 
 
   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   4.0.0
   
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
   
   Sharding-JDBC
   
   ### Expected behavior
   
   Update from 3.1.0 to 4.0.0 would not change the parser rules.
   
   ### Actual behavior
   
   Integration tests fail because flyway can't perform a migration when executing `select CURRENT_USER`
   
   ### Reason analyze (If you can)
   
   ```
   org.postgresql:postgresql:42.2.6
   org.flywaydb:flyway-core:5.2.4
   org.testcontainers:postgresql:1.12.0
   
   sql = "SELECT CURRENT_USER"
   parseEngine = {SQLParseEngine@4966} 
    databaseTypeName = "PostgreSQL"
   
   line 1:7 mismatched input 'CURRENT_USER' expecting {'U', 'u', '!', '~', '+', '-', '*', '(', '{', '?', INSERT, UPDATE, DELETE, ALTER, DROP, TRUNCATE, SCHEMA, REVOKE, ADD, SET, INDEX, KEY, FUNCTION, TRIGGER, PROCEDURE, DISTINCT, CASE, CAST, IF, NOT, NULL, TRUE, FALSE, EXISTS, ALL, 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, 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, IDENTIFIER_, STRING_, NUMBER_, HEX_DIGIT_, BIT_NUM_}
   
   java.lang.IllegalStateException
   	at com.google.common.base.Preconditions.checkState(Preconditions.java:429)
   	at org.apache.shardingsphere.sql.parser.core.extractor.util.ExtractorUtils.getFirstChildNode(ExtractorUtils.java:48)
   	at org.apache.shardingsphere.sql.parser.core.extractor.impl.dml.select.SelectItemsExtractor.extract(SelectItemsExtractor.java:54)
   	at org.apache.shardingsphere.sql.parser.core.extractor.SQLSegmentsExtractorEngine.extract(SQLSegmentsExtractorEngine.java:47)
   	at org.apache.shardingsphere.sql.parser.core.SQLParseKernel.parse(SQLParseKernel.java:59)
   	at org.apache.shardingsphere.sql.parser.SQLParseEngine.parse0(SQLParseEngine.java:70)
   	at org.apache.shardingsphere.sql.parser.SQLParseEngine.parse(SQLParseEngine.java:52)
   	at org.apache.shardingsphere.core.route.router.masterslave.MasterSlaveRouter.route(MasterSlaveRouter.java:56)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.MasterSlavePreparedStatement.<init>(MasterSlavePreparedStatement.java:68)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.MasterSlavePreparedStatement.<init>(MasterSlavePreparedStatement.java:53)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.connection.MasterSlaveConnection.prepareStatement(MasterSlaveConnection.java:76)
   	at org.flywaydb.core.internal.jdbc.JdbcTemplate.prepareStatement(JdbcTemplate.java:333)
   	at org.flywaydb.core.internal.jdbc.JdbcTemplate.queryForString(JdbcTemplate.java:190)
   	at org.flywaydb.core.internal.database.postgresql.PostgreSQLConnection.<init>(PostgreSQLConnection.java:48)
   	at org.flywaydb.core.internal.database.postgresql.PostgreSQLDatabase.getConnection(PostgreSQLDatabase.java:56)
   	at org.flywaydb.core.internal.database.postgresql.PostgreSQLDatabase.getConnection(PostgreSQLDatabase.java:31)
   	at org.flywaydb.core.internal.database.base.Database.getMainConnection(Database.java:366)
   	at org.flywaydb.core.Flyway.prepareSchemas(Flyway.java:1773)
   	at org.flywaydb.core.Flyway.execute(Flyway.java:1678)
   	at org.flywaydb.core.Flyway.migrate(Flyway.java:1356)
   ```
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   Should be reproducible if the mentioned statement is executed with the PostgreSQL SQLParseEngine 
   
   ### 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] SteNicholas edited a comment on issue #3990: Parse engine rejects CURRENT_USER in 4.0.0

Posted by GitBox <gi...@apache.org>.
SteNicholas edited a comment on issue #3990: Parse engine rejects CURRENT_USER in 4.0.0
URL: https://github.com/apache/incubator-shardingsphere/issues/3990#issuecomment-574947143
 
 
   @encodeering 4.0.0 PostgreSQLParser doesn't support `SELECT CURRENT_USER`, I would like to add the keyword to `simpleExpr`.

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] tristaZero closed issue #3990: Parse engine rejects CURRENT_USER in 4.0.0

Posted by GitBox <gi...@apache.org>.
tristaZero closed issue #3990: Parse engine rejects CURRENT_USER in 4.0.0
URL: https://github.com/apache/incubator-shardingsphere/issues/3990
 
 
   

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] encodeering commented on issue #3990: Parse engine rejects CURRENT_USER in 4.0.0

Posted by GitBox <gi...@apache.org>.
encodeering commented on issue #3990: Parse engine rejects CURRENT_USER in 4.0.0
URL: https://github.com/apache/incubator-shardingsphere/issues/3990#issuecomment-576148599
 
 
   Hi @SteNicholas @terrymanu, thanks for the fast reply. 
   
   Could you please point me to a maven repository where I could test the current snapshot?
   Would it be possible to have this change also part of a 4.0.x release if the schedule for 5.x is not yet known?

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] encodeering opened a new issue #3990: Parse engine rejects CURRENT_USER in 4.0.0

Posted by GitBox <gi...@apache.org>.
encodeering opened a new issue #3990: Parse engine rejects CURRENT_USER in 4.0.0
URL: https://github.com/apache/incubator-shardingsphere/issues/3990
 
 
   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   4.0.0
   
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
   
   Sharding-JDBC
   
   ### Expected behavior
   
   Update from 3.1.0 to 4.0.0 would not change the parser rules.
   
   ### Actual behavior
   
   Integration tests fail because flyway can't perform a migration when executing `select CURRENT_USER`
   
   ### Reason analyze (If you can)
   
   ```
   org.postgresql:postgresql:42.2.6
   org.flywaydb:flyway-core:5.2.4
   org.testcontainers:postgresql:1.12.0
   
   sql = "SELECT CURRENT_USER"
   parseEngine = {SQLParseEngine@4966} 
    databaseTypeName = "PostgreSQL"
   
   line 1:7 mismatched input 'CURRENT_USER' expecting {'U', 'u', '!', '~', '+', '-', '*', '(', '{', '?', INSERT, UPDATE, DELETE, ALTER, DROP, TRUNCATE, SCHEMA, REVOKE, ADD, SET, INDEX, KEY, FUNCTION, TRIGGER, PROCEDURE, DISTINCT, CASE, CAST, IF, NOT, NULL, TRUE, FALSE, EXISTS, ALL, 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, 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, IDENTIFIER_, STRING_, NUMBER_, HEX_DIGIT_, BIT_NUM_}
   
   java.lang.IllegalStateException
   	at com.google.common.base.Preconditions.checkState(Preconditions.java:429)
   	at org.apache.shardingsphere.sql.parser.core.extractor.util.ExtractorUtils.getFirstChildNode(ExtractorUtils.java:48)
   	at org.apache.shardingsphere.sql.parser.core.extractor.impl.dml.select.SelectItemsExtractor.extract(SelectItemsExtractor.java:54)
   	at org.apache.shardingsphere.sql.parser.core.extractor.SQLSegmentsExtractorEngine.extract(SQLSegmentsExtractorEngine.java:47)
   	at org.apache.shardingsphere.sql.parser.core.SQLParseKernel.parse(SQLParseKernel.java:59)
   	at org.apache.shardingsphere.sql.parser.SQLParseEngine.parse0(SQLParseEngine.java:70)
   	at org.apache.shardingsphere.sql.parser.SQLParseEngine.parse(SQLParseEngine.java:52)
   	at org.apache.shardingsphere.core.route.router.masterslave.MasterSlaveRouter.route(MasterSlaveRouter.java:56)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.MasterSlavePreparedStatement.<init>(MasterSlavePreparedStatement.java:68)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.MasterSlavePreparedStatement.<init>(MasterSlavePreparedStatement.java:53)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.connection.MasterSlaveConnection.prepareStatement(MasterSlaveConnection.java:76)
   	at org.flywaydb.core.internal.jdbc.JdbcTemplate.prepareStatement(JdbcTemplate.java:333)
   	at org.flywaydb.core.internal.jdbc.JdbcTemplate.queryForString(JdbcTemplate.java:190)
   	at org.flywaydb.core.internal.database.postgresql.PostgreSQLConnection.<init>(PostgreSQLConnection.java:48)
   	at org.flywaydb.core.internal.database.postgresql.PostgreSQLDatabase.getConnection(PostgreSQLDatabase.java:56)
   	at org.flywaydb.core.internal.database.postgresql.PostgreSQLDatabase.getConnection(PostgreSQLDatabase.java:31)
   	at org.flywaydb.core.internal.database.base.Database.getMainConnection(Database.java:366)
   	at org.flywaydb.core.Flyway.prepareSchemas(Flyway.java:1773)
   	at org.flywaydb.core.Flyway.execute(Flyway.java:1678)
   	at org.flywaydb.core.Flyway.migrate(Flyway.java:1356)
   ```
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   Should be reproducible if the mentioned statement is executed with the PostgreSQL SQLParseEngine 
   
   ### 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] encodeering closed issue #3990: Parse engine rejects CURRENT_USER in 4.0.0

Posted by GitBox <gi...@apache.org>.
encodeering closed issue #3990: Parse engine rejects CURRENT_USER in 4.0.0
URL: https://github.com/apache/incubator-shardingsphere/issues/3990
 
 
   

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] SteNicholas commented on issue #3990: Parse engine rejects CURRENT_USER in 4.0.0

Posted by GitBox <gi...@apache.org>.
SteNicholas commented on issue #3990: Parse engine rejects CURRENT_USER in 4.0.0
URL: https://github.com/apache/incubator-shardingsphere/issues/3990#issuecomment-576176709
 
 
   @encodeering Hi encodeering, you should clone the shardingsphere to local, checkout the dev branch, and execute `mvn clean install -DskipTests -Dfast` to compile. Then you could use the compiled version for you application. 5.X version doesn't release. 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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] SteNicholas edited a comment on issue #3990: Parse engine rejects CURRENT_USER in 4.0.0

Posted by GitBox <gi...@apache.org>.
SteNicholas edited a comment on issue #3990: Parse engine rejects CURRENT_USER in 4.0.0
URL: https://github.com/apache/incubator-shardingsphere/issues/3990#issuecomment-576176709
 
 
   @encodeering Hi encodeering, you should clone the shardingsphere to local, checkout the dev branch, and execute `mvn clean install -DskipTests -Dfast` to compile. Then you could use the compiled version for you application. 5.X version doesn't release. If you don't have any question, please close this issue. 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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] encodeering commented on issue #3990: Parse engine rejects CURRENT_USER in 4.0.0

Posted by GitBox <gi...@apache.org>.
encodeering commented on issue #3990: Parse engine rejects CURRENT_USER in 4.0.0
URL: https://github.com/apache/incubator-shardingsphere/issues/3990#issuecomment-576235179
 
 
   Okay, will do that, thanks for the command line :+1:

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] SteNicholas commented on issue #3990: Parse engine rejects CURRENT_USER in 4.0.0

Posted by GitBox <gi...@apache.org>.
SteNicholas commented on issue #3990: Parse engine rejects CURRENT_USER in 4.0.0
URL: https://github.com/apache/incubator-shardingsphere/issues/3990#issuecomment-574947143
 
 
   @encodeering 4.0.0 doesn't support this function call, I will add to parse rules.

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


With regards,
Apache Git Services