pg
pg copied to clipboard
Empty Select when Column("_") is used
When I already have a model in memory and I want to load a relation of that model I do something like this:
db.Model(&user).
Column("_").
WherePK().
Relation("Roles").
Select()
This will generate an extra very silly and unneeded empty query.
SELECT FROM "users" AS "user" WHERE "user"."id" = 6
I tend to load the info all at once but sometimes is way too complicated.
I understand that this is the desired result of Column("_") but this makes sense on "has one" relations where there will be a JOIN and the other tables columns will be selected. On the other relations looks like a bug.
Using: go-pg: v9.1.6