You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, with v4.17.0 the following fix was introduced:
Count from subquery if query uses HAVING or GROUP BY. This is because aggregate functions are run for each group separately, but we need to return the count of returned rows.
PR: #1398
When using this fix with Postgres, the following error is returned: pq: subquery in FROM must have an alias
Here an example:
CREATETABLEitems (
id serialPRIMARY KEY,
category varchar(255) NOT NULL,
is_special booleanNOT NULL
);
Example usage:
count, err:=models.Items(
models.ItemWhere.IsSpecial.EQ(true),
// group because of possible joins to other tablesqm.GroupBy(models.ItemColumns.ID),
).Count(boil.WithDebug(ctx, true), s.DB)
require.NoError(t, err)
SQL:
SELECTCOUNT(*) FROM (SELECT*FROM"items"WHERE ("items"."is_special"= $1) GROUP BY id);
[true]
Hey, with v4.17.0 the following fix was introduced:
When using this fix with Postgres, the following error is returned:
pq: subquery in FROM must have an alias
Here an example:
Example usage:
SQL:
You can try it in https://onecompiler.com/postgresql/435bk9nra if you remove the as foo
The text was updated successfully, but these errors were encountered: