Skip to content

Conversation

@a631807682
Copy link
Member

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

When we use db.Preload, it will generate sql with alias like:

SELECT * FROM "orders" WHERE "orders"."user_id" = 1

The expr parsed by sql is sqlparser.QualifiedRef which is not supported and will return ErrMissingShardingKey
This feat will replace sql like this:

SELECT * FROM "orders_1" as "orders" WHERE "orders"."user_id" = 1

User Case Description

@a631807682 a631807682 changed the title fix: support sharding sql with alias in where clause fix(WIP): support sharding sql with alias in where clause May 5, 2022
@a631807682 a631807682 changed the title fix(WIP): support sharding sql with alias in where clause fix: support sharding sql with alias in where clause May 5, 2022
@a631807682
Copy link
Member Author

a631807682 commented May 5, 2022

related to go-gorm/gorm#5301
will not panic in next gorm version
test will pass when #34 merged.

@ifooth
Copy link

ifooth commented May 20, 2023

Any Update?, Support for the sqlparser.QualifiedRef feature is quite needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants