You are given daily system error logs and asked to calculate a rolling 7-day average of errors for each day in the series. Use PostgreSQL-compatible SQL to return one row per calendar day with the daily error count and the 7-day trailing average, including days with zero errors. Do not use MySQL-only syntax.
| Column | Type | Description |
|---|---|---|
| error_idPK | INT | Primary key for each error event |
| occurred_at | TIMESTAMP | Timestamp when the error occurred |
| system_name | VARCHAR(100) | Name of the system that emitted the error |
| severity | VARCHAR(20) | Error severity level |