From: fabiobaiao (@fabiobaiao) <noreply+fabiobaiao@github.com>
To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>
Subject: [pgaudit/pgaudit] issue #205: `INSERT` with `RETURNING` emits a log over a column that's not being selected
Date: Tue, 28 Feb 2023 17:31:42 +0000
Message-ID: <gh-pgaudit-pgaudit-205@github.com> (raw)
An
```sql
INSERT INTO "table"("col1", "col2") VALUES ('foo', 'bar') RETURNING "col1";
```
with a
```sql
GRANT SELECT("col2") on TABLE "table" TO "auditor";
```
emits an audit log.
It seems that the `insertedCols` are being checked against both the `INSERT` and `SELECT` grants, whilst I guess it should be checking the latter grant against the `selectedCols`.