diff options
author | Alexander Korotkov <akorotkov@postgresql.org> | 2022-12-09 13:12:20 +0300 |
---|---|---|
committer | Alexander Korotkov <akorotkov@postgresql.org> | 2022-12-09 13:12:20 +0300 |
commit | 096dd80f3ccc103c8e078fca05e6ccfb2071aa91 (patch) | |
tree | bfcd25f09b535b52d0e0373c9f8909b030f3a537 /src/bin/pg_dump/dumputils.c | |
parent | 5defdef8aa0535b8e9365ea9cceee60d5731395f (diff) | |
download | postgresql-096dd80f3ccc103c8e078fca05e6ccfb2071aa91.tar.gz postgresql-096dd80f3ccc103c8e078fca05e6ccfb2071aa91.zip |
Add USER SET parameter values for pg_db_role_setting
The USER SET flag specifies that the variable should be set on behalf of an
ordinary role. That lets ordinary roles set placeholder variables, which
permission requirements are not known yet. Such a value wouldn't be used if
the variable finally appear to require superuser privileges.
The new flags are stored in the pg_db_role_setting.setuser array. Catversion
is bumped.
This commit is inspired by the previous work by Steve Chavez.
Discussion: https://postgr.es/m/CAPpHfdsLd6E--epnGqXENqLP6dLwuNZrPMcNYb3wJ87WR7UBOQ%40mail.gmail.com
Author: Alexander Korotkov, Steve Chavez
Reviewed-by: Pavel Borisov, Steve Chavez
Diffstat (limited to 'src/bin/pg_dump/dumputils.c')
-rw-r--r-- | src/bin/pg_dump/dumputils.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bin/pg_dump/dumputils.c b/src/bin/pg_dump/dumputils.c index 9311417f18c..c0985fae5ad 100644 --- a/src/bin/pg_dump/dumputils.c +++ b/src/bin/pg_dump/dumputils.c @@ -816,6 +816,7 @@ SplitGUCList(char *rawstring, char separator, */ void makeAlterConfigCommand(PGconn *conn, const char *configitem, + const char *userset, const char *type, const char *name, const char *type2, const char *name2, PQExpBuffer buf) @@ -874,6 +875,10 @@ makeAlterConfigCommand(PGconn *conn, const char *configitem, else appendStringLiteralConn(buf, pos, conn); + /* Add USER SET flag if specified in the string */ + if (userset && !strcmp(userset, "t")) + appendPQExpBufferStr(buf, " USER SET"); + appendPQExpBufferStr(buf, ";\n"); pg_free(mine); |