You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SQL语句:
SELECT
i.*
FROM
t_order o, t_order_item i
WHERE
o.order_id = i.order_id
此时sql语句中表名大小写跟逻辑表中不一致,无法查询到结果
日志打印:
[INFO ] 2017-12-15 10:30:03,733 --main-- [Sharding-JDBC-SQL] Actual SQL: demo_ds ::: SELECT
i.*
FROM
t_order o, t_order_item_0 i
WHERE
o.order_id = i.order_id
[INFO ] 2017-12-15 10:30:03,733 --main-- [Sharding-JDBC-SQL] Actual SQL: demo_ds ::: SELECT
i.*
FROM
t_order o, t_order_item_1 i
WHERE
o.order_id = i.order_id
[INFO ] 2017-12-15 10:30:03,733 --main-- [Sharding-JDBC-SQL] Actual SQL: demo_ds ::: SELECT
i.*
FROM
t_order o, t_order_item_2 i
WHERE
o.order_id = i.order_id
[]
我把逻辑表的大小写改为跟查询sql的一致,就能正常查到结果
日志:
[INFO ] 2017-12-15 10:35:57,524 --main-- [Sharding-JDBC-SQL] Actual SQL: demo_ds ::: SELECT
i.*
FROM
t_order_0 o, t_order_item_0 i
WHERE
o.order_id = i.order_id
[INFO ] 2017-12-15 10:35:57,524 --main-- [Sharding-JDBC-SQL] Actual SQL: demo_ds ::: SELECT
i.*
FROM
t_order_1 o, t_order_item_1 i
WHERE
o.order_id = i.order_id
[INFO ] 2017-12-15 10:35:57,524 --main-- [Sharding-JDBC-SQL] Actual SQL: demo_ds ::: SELECT
i.*
FROM
t_order_2 o, t_order_item_2 i
WHERE
o.order_id = i.order_id
[order_item_id:148374419964690432, order_id: 148374419926941696, user_id: 51, status: INSERT_TEST, order_item_id:148374419994050560, order_id: 148374419977273344, user_id: 51, status: INSERT_TEST, order_item_id:148374420115685376, order_id: 148374420103102464, user_id: 51, status: INSERT_TEST, order_item_id:148374420161822720, order_id: 148374420153434112, user_id: 51, status: INSERT_TEST, order_item_id:148374420019216384, order_id: 148374420006633472, user_id: 51, status: INSERT_TEST, order_item_id:148374420044382208, order_id: 148374420031799296, user_id: 51, status: INSERT_TEST, order_item_id:148374420069548032, order_id: 148374420056965120, user_id: 51, status: INSERT_TEST, order_item_id:148374420090519552, order_id: 148374420082130944, user_id: 51, status: INSERT_TEST, order_item_id:148374420136656896, order_id: 148374420124073984, user_id: 51, status: INSERT_TEST, order_item_id:148374420186988544, order_id: 148374420174405632, user_id: 51, status: INSERT_TEST]
The text was updated successfully, but these errors were encountered:
目前sql查询的表名必须跟逻辑表填写的大小写一致,能否改为忽略大小写呢
配置:
<sharding:sharding-rule data-source-names="demo_ds">
sharding:table-rules
<sharding:table-rule logic-table="T_ORDER" actual-data-nodes="demo_ds.t_order_${0..2}" table-strategy-ref="orderTableShardingStrategy" generate-key-column="order_id" />
<sharding:table-rule logic-table="T_ORDER_ITEM" actual-data-nodes="demo_ds.t_order_item_${0..2}" table-strategy-ref="orderItemTableShardingStrategy" generate-key-column="order_item_id" />
</sharding:table-rules>
sharding:binding-table-rules
<sharding:binding-table-rule logic-tables="t_order, t_order_item"/>
</sharding:binding-table-rules>
SQL语句:
SELECT
i.*
FROM
t_order o, t_order_item i
WHERE
o.order_id = i.order_id
此时sql语句中表名大小写跟逻辑表中不一致,无法查询到结果
日志打印:
[INFO ] 2017-12-15 10:30:03,733 --main-- [Sharding-JDBC-SQL] Actual SQL: demo_ds ::: SELECT
i.*
FROM
t_order o, t_order_item_0 i
WHERE
o.order_id = i.order_id
[INFO ] 2017-12-15 10:30:03,733 --main-- [Sharding-JDBC-SQL] Actual SQL: demo_ds ::: SELECT
i.*
FROM
t_order o, t_order_item_1 i
WHERE
o.order_id = i.order_id
[INFO ] 2017-12-15 10:30:03,733 --main-- [Sharding-JDBC-SQL] Actual SQL: demo_ds ::: SELECT
i.*
FROM
t_order o, t_order_item_2 i
WHERE
o.order_id = i.order_id
[]
我把逻辑表的大小写改为跟查询sql的一致,就能正常查到结果
日志:
[INFO ] 2017-12-15 10:35:57,524 --main-- [Sharding-JDBC-SQL] Actual SQL: demo_ds ::: SELECT
i.*
FROM
t_order_0 o, t_order_item_0 i
WHERE
o.order_id = i.order_id
[INFO ] 2017-12-15 10:35:57,524 --main-- [Sharding-JDBC-SQL] Actual SQL: demo_ds ::: SELECT
i.*
FROM
t_order_1 o, t_order_item_1 i
WHERE
o.order_id = i.order_id
[INFO ] 2017-12-15 10:35:57,524 --main-- [Sharding-JDBC-SQL] Actual SQL: demo_ds ::: SELECT
i.*
FROM
t_order_2 o, t_order_item_2 i
WHERE
o.order_id = i.order_id
[order_item_id:148374419964690432, order_id: 148374419926941696, user_id: 51, status: INSERT_TEST, order_item_id:148374419994050560, order_id: 148374419977273344, user_id: 51, status: INSERT_TEST, order_item_id:148374420115685376, order_id: 148374420103102464, user_id: 51, status: INSERT_TEST, order_item_id:148374420161822720, order_id: 148374420153434112, user_id: 51, status: INSERT_TEST, order_item_id:148374420019216384, order_id: 148374420006633472, user_id: 51, status: INSERT_TEST, order_item_id:148374420044382208, order_id: 148374420031799296, user_id: 51, status: INSERT_TEST, order_item_id:148374420069548032, order_id: 148374420056965120, user_id: 51, status: INSERT_TEST, order_item_id:148374420090519552, order_id: 148374420082130944, user_id: 51, status: INSERT_TEST, order_item_id:148374420136656896, order_id: 148374420124073984, user_id: 51, status: INSERT_TEST, order_item_id:148374420186988544, order_id: 148374420174405632, user_id: 51, status: INSERT_TEST]
The text was updated successfully, but these errors were encountered: