diff options
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/pg_dump/pg_dumpall.c | 25 | ||||
-rw-r--r-- | src/bin/psql/describe.c | 8 |
2 files changed, 30 insertions, 3 deletions
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index bf91d726ce8..beeba1cb528 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -653,16 +653,26 @@ dumpRoles(PGconn *conn) i_rolconnlimit, i_rolpassword, i_rolvaliduntil, + i_rolreplication, i_rolcomment; int i; /* note: rolconfig is dumped later */ - if (server_version >= 80200) + if (server_version >= 90100) printfPQExpBuffer(buf, "SELECT rolname, rolsuper, rolinherit, " "rolcreaterole, rolcreatedb, rolcatupdate, " "rolcanlogin, rolconnlimit, rolpassword, " - "rolvaliduntil, " + "rolvaliduntil, rolreplication, " + "pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment " + "FROM pg_authid " + "ORDER BY 1"); + else if (server_version >= 80200) + printfPQExpBuffer(buf, + "SELECT rolname, rolsuper, rolinherit, " + "rolcreaterole, rolcreatedb, rolcatupdate, " + "rolcanlogin, rolconnlimit, rolpassword, " + "rolvaliduntil, false as rolreplication, " "pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment " "FROM pg_authid " "ORDER BY 1"); @@ -671,7 +681,8 @@ dumpRoles(PGconn *conn) "SELECT rolname, rolsuper, rolinherit, " "rolcreaterole, rolcreatedb, rolcatupdate, " "rolcanlogin, rolconnlimit, rolpassword, " - "rolvaliduntil, null as rolcomment " + "rolvaliduntil, false as rolreplication, " + "null as rolcomment " "FROM pg_authid " "ORDER BY 1"); else @@ -686,6 +697,7 @@ dumpRoles(PGconn *conn) "-1 as rolconnlimit, " "passwd as rolpassword, " "valuntil as rolvaliduntil, " + "false as rolreplication, " "null as rolcomment " "FROM pg_shadow " "UNION ALL " @@ -699,6 +711,7 @@ dumpRoles(PGconn *conn) "-1 as rolconnlimit, " "null::text as rolpassword, " "null::abstime as rolvaliduntil, " + "false as rolreplication, " "null as rolcomment " "FROM pg_group " "WHERE NOT EXISTS (SELECT 1 FROM pg_shadow " @@ -717,6 +730,7 @@ dumpRoles(PGconn *conn) i_rolconnlimit = PQfnumber(res, "rolconnlimit"); i_rolpassword = PQfnumber(res, "rolpassword"); i_rolvaliduntil = PQfnumber(res, "rolvaliduntil"); + i_rolreplication = PQfnumber(res, "rolreplication"); i_rolcomment = PQfnumber(res, "rolcomment"); if (PQntuples(res) > 0) @@ -765,6 +779,11 @@ dumpRoles(PGconn *conn) else appendPQExpBuffer(buf, " NOLOGIN"); + if (strcmp(PQgetvalue(res, i, i_rolreplication), "t") == 0) + appendPQExpBuffer(buf, " REPLICATION"); + else + appendPQExpBuffer(buf, " NOREPLICATION"); + if (strcmp(PQgetvalue(res, i, i_rolconnlimit), "-1") != 0) appendPQExpBuffer(buf, " CONNECTION LIMIT %s", PQgetvalue(res, i, i_rolconnlimit)); diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index c4370a1dd39..edbe882963a 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -2195,6 +2195,10 @@ describeRoles(const char *pattern, bool verbose) appendPQExpBufferStr(&buf, "\n, pg_catalog.shobj_description(r.oid, 'pg_authid') AS description"); ncols++; } + if (pset.sversion >= 90100) + { + appendPQExpBufferStr(&buf,"\n, r.rolreplication"); + } appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n"); @@ -2254,6 +2258,10 @@ 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, 8), "t") == 0) + add_role_attribute(&buf, _("Replication")); + conns = atoi(PQgetvalue(res, i, 6)); if (conns >= 0) { |