Hi,
Currently, in situation such as duplicate role creation, the server log would show something such as the following:
2022-07-22 13:48:18.251 UTC [330] STATEMENT: CREATE ROLE test WITH LOGIN PASSWORD 'foobar';
The password itself should be redacted before logging the statement.
Here is sample output with the patch applied:
2022-07-23 23:28:20.359 UTC [16850] ERROR: role "test" already exists
2022-07-23 23:28:20.359 UTC [16850] STATEMENT: CREATE ROLE test WITH LOGIN PASSWORD
Please take a look at the short patch.
I know variables should be declared at the start of the func - I can do that once the approach is confirmed.
Cheers