psql_describe_role_add_valid_until.patch
text/x-patch
Filename: psql_describe_role_add_valid_until.patch
Type: text/x-patch
Part: 0
Message:
Re: VALID UNTIL
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 | + | − |
|---|---|---|
| src/bin/psql/describe.c | 11 | 0 |
*** a/src/bin/psql/describe.c
--- b/src/bin/psql/describe.c
***************
*** 2382,2388 **** describeRoles(const char *pattern, bool verbose)
" ARRAY(SELECT b.rolname\n"
" FROM pg_catalog.pg_auth_members m\n"
" JOIN pg_catalog.pg_roles b ON (m.roleid = b.oid)\n"
! " WHERE m.member = r.oid) as memberof");
if (verbose && pset.sversion >= 80200)
{
--- 2382,2389 ----
" ARRAY(SELECT b.rolname\n"
" FROM pg_catalog.pg_auth_members m\n"
" JOIN pg_catalog.pg_roles b ON (m.roleid = b.oid)\n"
! " WHERE m.member = r.oid) as memberof,\n"
! " 'Valid until '::text||r.rolvaliduntil::text as rolvaliduntil");
if (verbose && pset.sversion >= 80200)
{
***************
*** 2407,2413 **** describeRoles(const char *pattern, bool verbose)
" true AS rolinherit, false AS rolcreaterole,\n"
" u.usecreatedb AS rolcreatedb, true AS rolcanlogin,\n"
" -1 AS rolconnlimit,\n"
! " ARRAY(SELECT g.groname FROM pg_catalog.pg_group g WHERE u.usesysid = ANY(g.grolist)) as memberof"
"\nFROM pg_catalog.pg_user u\n");
processSQLNamePattern(pset.db, &buf, pattern, false, false,
--- 2408,2415 ----
" true AS rolinherit, false AS rolcreaterole,\n"
" u.usecreatedb AS rolcreatedb, true AS rolcanlogin,\n"
" -1 AS rolconnlimit,\n"
! " ARRAY(SELECT g.groname FROM pg_catalog.pg_group g WHERE u.usesysid = ANY(g.grolist)) as memberof,\n"
! " 'Valid until '::text||u.valuntil::text as rolvaliduntil"
"\nFROM pg_catalog.pg_user u\n");
processSQLNamePattern(pset.db, &buf, pattern, false, false,
***************
*** 2452,2459 **** describeRoles(const char *pattern, bool verbose)
if (strcmp(PQgetvalue(res, i, 5), "t") != 0)
add_role_attribute(&buf, _("Cannot login"));
if (pset.sversion >= 90100)
! if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
conns = atoi(PQgetvalue(res, i, 6));
--- 2454,2464 ----
if (strcmp(PQgetvalue(res, i, 5), "t") != 0)
add_role_attribute(&buf, _("Cannot login"));
+ if (strcmp(PQgetvalue(res, i, 8), "") != 0 && verbose)
+ add_role_attribute(&buf, PQgetvalue(res, i, 8));
+
if (pset.sversion >= 90100)
! if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
conns = atoi(PQgetvalue(res, i, 6));
***************
*** 2478,2485 **** describeRoles(const char *pattern, bool verbose)
printTableAddCell(&cont, PQgetvalue(res, i, 7), false, false);
if (verbose && pset.sversion >= 80200)
! printTableAddCell(&cont, PQgetvalue(res, i, 8), false, false);
! }
termPQExpBuffer(&buf);
printTable(&cont, pset.queryFout, pset.logfile);
--- 2483,2491 ----
printTableAddCell(&cont, PQgetvalue(res, i, 7), false, false);
if (verbose && pset.sversion >= 80200)
! printTableAddCell(&cont, PQgetvalue(res, i, 9), false, false);
!
! }
termPQExpBuffer(&buf);
printTable(&cont, pset.queryFout, pset.logfile);