odiseoteam / SyliusReportPlugin

Report Plugin for Sylius. This plugin add a report interface to the Sylius administration. Some reports comes with this bundle but you can create your custom reports.
MIT License
31 stars 10 forks source link

PostgresSQL Support #12

Closed markbeazley closed 2 years ago

markbeazley commented 4 years ago

I'm trying to add this plugin to our Sylius store, but we are using PostgresSQL as our database, I was able to use oroinc/doctrine-extensions to provide the SQL functions not available in beberlei/DoctrineExtensions for PostgresSQL.

I have run into an issue with queries using GROUP BY but that aren't including columns in the select list that aren't in the GROUP BY in an Aggregate function

An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT DATE(s0_.created_at) AS sclr_0, count(s0_.id) AS sclr_1, EXTRACT(MONTH FROM s0_.created_at) AS sclr_2, EXTRACT(YEAR FROM s0_.created_at) AS sclr_3 FROM sylius_order s0_ WHERE s0_.created_at >= ? AND s0_.created_at <= ? GROUP BY sclr_2, sclr_3 ORDER BY sclr_0 ASC, sclr_2 ASC, sclr_3 ASC' with params ["1920-04-02 00:00:00", "2020-04-02 16:08:04"]:

SQLSTATE[42803]: Grouping error: 7 ERROR: column "s0_.created_at" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT DATE(s0_.created_at) AS sclr_0, count(s0_.id) AS sclr...
^").

This is similar to issue #10 but that fix doesn't apply to Postgres.

bigboss86 commented 2 years ago

Fixed!