Closed phasetri closed 1 year ago
I believe you also need to use JoinOn in addition to the Join function and move the ON clause to the JoinOn
Tried it with JoinOn this time, but unfortunately it's yielding the same issue.
Model((*RoleRef)(nil)).
Join(`JOIN roles as role`).
JoinOn(`role.id = id`).
Where(`role.name = ?`, "Admin").
Delete()
Oh actually, I read that Postgres doesn't support DELTETE with JOIN. Rather, USING or IN should be used instead.
https://stackoverflow.com/questions/13364855/error-postgresql-delete-with-inner-join
I will close this issue.
Hello. I am wanting to create a SQL statement that involves a DELETE and JOIN keyword. Here is a small example:
Using go-pg, I'm using this code to mirror the above statement:
The table and column names don't really matter, but rather it's using both Join() and Delete(). However, when I execute the go-pg code, the assembled SQL statement is missing the JOIN statement completely:
I also tried replacing
Join()
withRelation()
but there is no JOIN keyword in the resulting SQL either.Is this a bug?