log_role_option.patch
text/x-diff
Filename: log_role_option.patch
Type: text/x-diff
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
| File | + | − |
|---|---|---|
| doc/src/sgml/config.sgml | 6 | 0 |
| src/backend/utils/error/elog.c | 10 | 0 |
*** a/doc/src/sgml/config.sgml
--- b/doc/src/sgml/config.sgml
***************
*** 3504,3510 **** local0.* /var/log/postgresql
</row>
<row>
<entry><literal>%u</literal></entry>
! <entry>User name</entry>
<entry>yes</entry>
</row>
<row>
--- 3504,3515 ----
</row>
<row>
<entry><literal>%u</literal></entry>
! <entry>User name which was used to authenticate to <productname>PostgreSQL</productname> with</entry>
! <entry>yes</entry>
! </row>
! <row>
! <entry><literal>%R</literal></entry>
! <entry>Current role name, set via <command>SET ROLE</>, the current role identifier is relevant for permission checking</entry>
<entry>yes</entry>
</row>
<row>
*** a/src/backend/utils/error/elog.c
--- b/src/backend/utils/error/elog.c
***************
*** 1826,1831 **** log_line_prefix(StringInfo buf, ErrorData *edata)
--- 1826,1841 ----
appendStringInfoString(buf, username);
}
break;
+ case 'R':
+ if (MyProcPort)
+ {
+ const char *rolename = GetUserNameFromId(GetUserId());
+
+ if (rolename == NULL || *rolename == '\0')
+ rolename = _("[unknown]");
+ appendStringInfoString(buf, rolename);
+ }
+ break;
case 'd':
if (MyProcPort)
{