; [1] https://code.djangoproject.com/ticket/10060
> [2]
> https://docs.djangoproject.com/en/1.9/topics/db/aggregation/#combining-multiple-aggregations
> [3]
> https://docs.djangoproject.com/en/1.9/topics/db/sql/#performing-raw-queries
>
> Le vendredi 4 mars 2016 17:49:00 UTC-5, Tomasz Nowa
After setting DatabaseFeatures.allows_group_by_selected_pks = False the
"extra(select=...)" version still copies the expression to the "GROUP BY":
GROUP BY (( SELECT json_agg(inseminacja.*) FROM inseminacja WHERE
inseminacja.cow_life_number = animal.life_number )), ...
W dniu piątek, 4 marca
Thomasz,
>>
>> I think this might be a bug in either your custom expressions or Django's
>> GROUP BY handling on PostgreSQL.
>>
>> Can you try setting
>> `django.db.backends.postgresql.features.DatabaseFeatures.allows_group_by_selected_pks`
>> t
ould be used.
Using DISTINCT is not possible, as "JSON_AGG(DISTINCT JSON_BUILD_OBJECT("
results in "ERROR: could not identify an equality operator for type json".
Using GROUP BY "animal"."life_number",
"wynikbadania"."timestamp","in
ArrayAgg(Row(F('field1'), F('field2'))),
> )
>
>
> Cheers,
> Simon
>
> [1]
> https://docs.djangoproject.com/en/1.9/ref/models/expressions/#writing-your-own-query-expressions
>
> Le lundi 29 février 2016 19:31:15 UTC-5, Tomasz Nowak a écrit :
>>
&
Hi!
Module django.contrib.postgres.aggregates provides classes for ARRAY_AGG
and STRING_AGG PostgreSQL aggregates.
Is it possible to provide more than one field to these aggregates?
Like in SQL, where you can provide more fields ("row" is optional):
ARRAY_AGG(row(table.field1, table.field2))
6 matches
Mail list logo