Trying to get a user with its associations with a where condition on the user:
err = db.
Model(&user).
Column("user.*", "Company", "PendingOperations").
Where("id = ?id").
First()
The problem:
Where("id = ?id") #=> Fail: ambiguous
```go
Where("user.id = ?id") #=> Fail: Syntax error
```go
Where("\"user\".\"id\" = ?id") #=> Works but ugly
Any insights on this?
user is a keyword in Postgres so you should escape it via Where(`"user".id = ?id`)
Thank you so much, been having trouble with it for a longtime !
Most helpful comment
user is a keyword in Postgres so you should escape it via Where(`"user".id = ?id`)