pg.ddx.io  pgaudit/pgaudit GitHub issues and pull requests  
help / color / mirror / Atom feed
From: filip-taxamo (@filip-taxamo) <noreply+filip-taxamo@github.com>
To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>
Subject: [pgaudit/pgaudit] issue #316: Redacted statements should still be valid SQL
Date: Mon, 01 Jun 2026 09:13:36 +0000
Message-ID: <gh-pgaudit-pgaudit-316@github.com> (raw)

We use pgaudit together with [pglast](https://pypi.org/project/pglast/) that we use to parse the logged statements.

Its generally works nicely, but there is a corner case where `pglast` is not happy with the result of [pgaudit password redaction](https://github.com/pgaudit/pgaudit/blob/34f123e632e27215cdf5ee1ada9bfa888f3e0e02/pgaudit.c#L643-L665), for example the following entry:

```
CREATE USER
\t  pgexporter
\tWITH
\t  PASSWORD <REDACTED>
```

results in:

```
[ERROR] ParseError: syntax error at or near "<", at index 44
[...]
  File "/var/task/rds_pgaudit_parser.py", line 225, in parse
    for statement in pglast.split(ev["statement"]):
  File "pglast/parser.pyx", line 412, in pglast.parser.split
```

[pglast/parser.pyx:412](https://github.com/lelit/pglast/blob/v7.7/pglast/parser.pyx#L412)

Would it be acceptable to change the [TOKEN_REDACTED](https://github.com/pgaudit/pgaudit/blob/34f123e632e27215cdf5ee1ada9bfa888f3e0e02/pgaudit.c#L224) constant from `"<REDACTED>"` to `"'<REDACTED>'"` so that the statement after redaction is still valid SQL?

view thread (6+ messages)  latest in thread

Message-ID: <gh-pgaudit-pgaudit-316@github.com>
Permalink:  ../gh-pgaudit-pgaudit-316@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox