I would need to get different statistics than are available in ST_SummaryStats.
In particular I need mode (majority) and variety (number of different values) for a discrete raster and according polygonal zones. This calculations are available for example in zonal statistics tool in QGIS, but I am looking for solution with PostGIS query.
Any clue?