@villebro here it is:
```sql
SELECT DATE_TRUNC('day', invoiceDate) AT TIME ZONE 'UTC' AS __timestamp,
COUNT(*) AS count FROM public."InvoiceLine" WHERE "invoiceDate" >= '2018-09-10
00:00:00' AND "invoiceDate" <= '2018-09-17 00:00:00' GROUP BY DATE_TRUNC('day',
invoiceDate) AT TIME ZONE 'UTC' ORDER BY count DESC LIMIT 10000
```
For the record, I applied this diff to "fix" the problem with a hack but I
don't think it is generic at all:
```diff
diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
index 176fbed0..a2ea8cac 100644
--- a/superset/db_engine_specs.py
+++ b/superset/db_engine_specs.py
@@ -397,15 +397,15 @@ class PostgresBaseEngineSpec(BaseEngineSpec):
engine = ''
time_grain_functions = {
- None: '{col}',
- 'PT1S': "DATE_TRUNC('second', {col}) AT TIME ZONE 'UTC'",
- 'PT1M': "DATE_TRUNC('minute', {col}) AT TIME ZONE 'UTC'",
- 'PT1H': "DATE_TRUNC('hour', {col}) AT TIME ZONE 'UTC'",
- 'P1D': "DATE_TRUNC('day', {col}) AT TIME ZONE 'UTC'",
- 'P1W': "DATE_TRUNC('week', {col}) AT TIME ZONE 'UTC'",
- 'P1M': "DATE_TRUNC('month', {col}) AT TIME ZONE 'UTC'",
- 'P0.25Y': "DATE_TRUNC('quarter', {col}) AT TIME ZONE 'UTC'",
- 'P1Y': "DATE_TRUNC('year', {col}) AT TIME ZONE 'UTC'",
+ None: '"{col}"',
+ 'PT1S': "DATE_TRUNC('second', \"{col}\") AT TIME ZONE 'UTC'",
+ 'PT1M': "DATE_TRUNC('minute', \"{col}\") AT TIME ZONE 'UTC'",
+ 'PT1H': "DATE_TRUNC('hour', \"{col}\") AT TIME ZONE 'UTC'",
+ 'P1D': "DATE_TRUNC('day', \"{col}\") AT TIME ZONE 'UTC'",
+ 'P1W': "DATE_TRUNC('week', \"{col}\") AT TIME ZONE 'UTC'",
+ 'P1M': "DATE_TRUNC('month', \"{col}\") AT TIME ZONE 'UTC'",
+ 'P0.25Y': "DATE_TRUNC('quarter', \"{col}\") AT TIME ZONE 'UTC'",
+ 'P1Y': "DATE_TRUNC('year', \"{col}\") AT TIME ZONE 'UTC'",
}
@classmethod
```
[ Full content available at:
https://github.com/apache/incubator-superset/issues/5886 ]
This message was relayed via gitbox.apache.org for [email protected]