Masterminds / squirrel

Fluent SQL generation for golang
Other
7.01k stars 465 forks source link

Misplaced params when using windows or subqueries #351

Open KyleSanderson opened 1 year ago

KyleSanderson commented 1 year ago

hi Team,

We've been using Squirrel for a while now and (frankly) love it. The thing we're coming up against is there's not a lot of great support for subqueries. We're using sq.Alias to give a Window on a Column, but when params are passed in Squirrel seems to place them using the initial index despite passing Expr's around in what looks like a supported fashion.

We've had to revert a code change that we found in testing here: https://github.com/autobrr/autobrr/pull/599

This also seems to go wrong when using the WHERE IN clause, but admittedly that seems to be less supported (although greatly desired).

Thoughts, directions, patches for us to test are greatly appreciated.

lann commented 1 year ago

Could you give an example?