Skip to content

Aggregation via json/jsonb column not possible #2

@lwitzani

Description

@lwitzani

Hi,
thank you for this code. I use it together with queryDsl and it works fine.
This is probably not directly connected with your code but maybe you know what the solution could be. I would like to have a simple query as the following:

SELECT entity_table.json ->> 'jsonKey'
FROM entity_table 
GROUP BY entity_table.json ->> 'jsonKey'

When i run this query it works directly on my postgres datatabase but if i build it in my spring boot java project and run it as native query or via queryDsl using your code then it won't work giving me an exception that the json column must be specified in the group by aggregation (which it obviously is).
In the queryDsl query it will contain something simimlar to group by hql_json_text(entityTable.json,?1) .

Do you have any idea how this could work? Maybe is registering a function in the dialect needed that enables aggregation of json/jsonb columns in 'group by' ?

Thank you :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions