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
I create a logical table named message, and use two underlying sharding tables: message_01 and message_02.
When using go-gorm/sharding plugin alone, everything works well, as in test case TestSharding.
However, after I added Clauses(hints.ForceIndex("idx_content")) in the query, the sharding plugin would fail, as in test case TestShardingAndForceIndex.
The error log shows Error 1146 (42S02): Table 'gorm.message' doesn't exist.
After some digging up, I found the cause of the issue comes from this line:
It seems sqlparser can't handle the FORCE INDEX syntax in SQL, causing the sharding plugin fails and falls back to original(not sharded) SQL.
A relevant issue: #91
The text was updated successfully, but these errors were encountered:
GORM Playground Link
go-gorm/playground#726
Description
I create a logical table named
message
, and use two underlying sharding tables:message_01
andmessage_02
.When using go-gorm/sharding plugin alone, everything works well, as in test case
TestSharding
.However, after I added Clauses(hints.ForceIndex("idx_content")) in the query, the sharding plugin would fail, as in test case
TestShardingAndForceIndex
.The error log shows
Error 1146 (42S02): Table 'gorm.message' doesn't exist
.After some digging up, I found the cause of the issue comes from this line:
sharding/sharding.go
Line 307 in 1ccc174
It seems
sqlparser
can't handle theFORCE INDEX
syntax in SQL, causing the sharding plugin fails and falls back to original(not sharded) SQL.A relevant issue: #91
The text was updated successfully, but these errors were encountered: