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 2019/10/31 01:27:36 UTC

[GitHub] [incubator-shardingsphere] hugo980521 opened a new issue #3416: Multischema query Error

hugo980521 opened a new issue #3416: Multischema query Error
URL: https://github.com/apache/incubator-shardingsphere/issues/3416
 
 
   
   
   ### Which version of ShardingSphere did you use?
   4.0.0-RC1 error
   3.1.0 normal
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
   sharding-jdbc
   ### Expected behavior
   rewrite sql contain schema,so can right run.
   ### Actual behavior
   rewrite sql doesn't contain schema.
   ### Reason analyze (If you can)
   
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   I have three schemas: ds0, ds1, test
   test also default datasource
   
   at ds0 create table test_a:
   CREATE TABLE `test_a` (
     `name` varchar(20) DEFAULT NULL COMMENT '名称',
     `code` varchar(20) DEFAULT NULL COMMENT '编码',
     `id` varchar(36) NOT NULL DEFAULT '',
     PRIMARY KEY (`id`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
   
   at ds1 create table test_b:
   CREATE TABLE `test_b` (
     `name` varchar(20) DEFAULT NULL COMMENT '名称',
     `code` varchar(20) DEFAULT NULL COMMENT '编码',
     `id` varchar(36) NOT NULL DEFAULT '',
     PRIMARY KEY (`id`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
   
   at test execute sql:
   	select e.* from (
   		SELECT
   		c.`id` AS idStr,
   		c.`code` AS `code`,
   		c.`name` AS `name`
   		FROM
   		`ds0`.`test_a` c
   		UNION ALL
   		SELECT
   		`a`.`id` AS idStr,
   		`a`.`code` AS `code`,
   		`a`.`name` AS `name`
   		FROM
   		 `ds1`.`test_b` a
   		) e
   
   error info as bellow:
   2019-10-31 09:25:36.838  INFO 9720 --- [nio-8084-exec-1] ShardingSphere-SQL                       : Actual SQL: test ::: 
   		select e.* from (
   		SELECT
   		c.`id` AS idStr,
   		c.`code` AS `code`,
   		c.`name` AS `name`
   		FROM
   		`test_a` c
   		UNION ALL
   		SELECT
   		`a`.`id` AS idStr,
   		`a`.`code` AS `code`,
   		`a`.`name` AS `name`
   		FROM
   		 `test_b` a
   		) e
   com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test.test_a' doesn't exist
   
   
   ### 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