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'm trying to use sharding combined with the autogenerated dal in gorm.
The autogenerated dal generates query that looks as:
SELECT*FROM`toys`WHERE`toys`.`name`="shard1"AND`toys`.`owner_type`="dummy"AND`toys`.`deleted_at` IS NULLORDER BY`toys`.`id`LIMIT1
In this commit @Gowa2017 fixed the "finding" whether or not there is a filter for the sharding column, but there is another issue.
This query is changed into
SELECT*FROM`toys_shard1`WHERE`toys`.`name`="shard1"AND`toys`.`owner_type`="dummy"AND`toys`.`deleted_at` IS NULLORDER BY`toys`.`id`LIMIT1
After the sharding plugin changes it, it then gets the error no such column: toys.name because the plugin doesn't change the where clauses.
I managed to trace back the actual error to this code.
I thought on a quick fix which is changing the from table but adding an "AS <origin_table>".
Don't mind to contribute this, I guess that it is simple as adding an alias like
GORM Playground Link
https://github.com/omer9564/gorm-playground-sharding-issue
Description
I'm trying to use sharding combined with the autogenerated dal in gorm.
The autogenerated dal generates query that looks as:
In this commit @Gowa2017 fixed the "finding" whether or not there is a filter for the sharding column, but there is another issue.
This query is changed into
After the sharding plugin changes it, it then gets the error
no such column: toys.name
because the plugin doesn't change the where clauses.I managed to trace back the actual error to this code.
I thought on a quick fix which is changing the from table but adding an "AS <origin_table>".
Don't mind to contribute this, I guess that it is simple as adding an alias like
Anyway would love a second eye on that
The text was updated successfully, but these errors were encountered: