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
My test suite blew up in the upgrade from 10.2.0 to 10.3.0/10.3.1.
I have Property which has many Image with an order. I use morphOne()->ofMany() to fetch properties with their primary image (i.e. with the minium order).
This worked fine on 10.2.0 but on 10.3.0 I get a query error:
SQLSTATE[42803]: Grouping error: 7 ERROR: column "images.order" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: ...oin (select min("images"."id") as "id_aggregate", "images"."... ^ (Connection: pgsql, SQL: select "images".* from "images" inner join (select min("images"."id") as "id_aggregate", "images"."order" as "order_aggregate", "images"."imageable_id", "images"."imageable_type" from "images" inner join (select min("images"."order") as "order_aggregate", "images"."imageable_id", "images"."imageable_type" from "images" where "images"."imageable_id" in (...) and "images"."imageable_type" = App\Models\Property group by "images"."imageable_id", "images"."imageable_type") as "image" on "image"."order_aggregate" = "images"."order" and "image"."imageable_type" = "images"."imageable_type" and "image"."imageable_id" = "images"."imageable_id" group by "images"."imageable_id", "images"."imageable_type") as "image" on "image"."id_aggregate" = "images"."id" and "image"."order_aggregate" = "images"."order" and "image"."imageable_type" = "images"."imageable_type" and "image"."imageable_id" = "images"."imageable_id")
Here's the basic model setup;
class Property extends Model
{
publicfunctionimage()
{
return$this->morphOne(Image::class, 'imageable')
->ofMany('order', 'min');
}
publicfunctionimages()
{
return$this->morphMany(Image::class, 'imageable');
}
}
class Image extends Model
{
publicfunctionimageable()
{
return$this->morphTo();
}
}
And the query that blows up;
Property::with('image')->simplePaginate();
As a sanity check I tested this against SQLite and it's a non issue. Didn't test against MySQL but I presume it may be Postgres specific.
Description:
My test suite blew up in the upgrade from 10.2.0 to 10.3.0/10.3.1.
I have
Property
which has manyImage
with an order. I usemorphOne()->ofMany()
to fetch properties with their primary image (i.e. with the miniumorder
).This worked fine on 10.2.0 but on 10.3.0 I get a query error:
Here's the basic model setup;
And the query that blows up;
As a sanity check I tested this against SQLite and it's a non issue. Didn't test against MySQL but I presume it may be Postgres specific.
Steps To Reproduce:
I've replicated this issue in a new Laravel app: https://github.com/dwightwatson/bug-report
The text was updated successfully, but these errors were encountered: