diff options
| author | Alexander Korotkov | 2022-12-09 10:12:20 +0000 |
|---|---|---|
| committer | Alexander Korotkov | 2022-12-09 10:12:20 +0000 |
| commit | 096dd80f3ccc103c8e078fca05e6ccfb2071aa91 (patch) | |
| tree | bfcd25f09b535b52d0e0373c9f8909b030f3a537 /src/include | |
| parent | 5defdef8aa0535b8e9365ea9cceee60d5731395f (diff) | |
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/include')
| -rw-r--r-- | src/include/catalog/catversion.h | 2 | ||||
| -rw-r--r-- | src/include/catalog/pg_db_role_setting.h | 2 | ||||
| -rw-r--r-- | src/include/nodes/parsenodes.h | 1 | ||||
| -rw-r--r-- | src/include/utils/guc.h | 11 |
4 files changed, 11 insertions, 5 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 51e5acfe4fb..17958aebf46 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -57,6 +57,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 202212061 +#define CATALOG_VERSION_NO 202212091 #endif diff --git a/src/include/catalog/pg_db_role_setting.h b/src/include/catalog/pg_db_role_setting.h index f92e867df45..c52bbf665f1 100644 --- a/src/include/catalog/pg_db_role_setting.h +++ b/src/include/catalog/pg_db_role_setting.h @@ -41,6 +41,8 @@ CATALOG(pg_db_role_setting,2964,DbRoleSettingRelationId) BKI_SHARED_RELATION #ifdef CATALOG_VARLEN /* variable-length fields start here */ text setconfig[1]; /* GUC settings to apply at login */ + + bool setuser[1]; /* USER SET flags for GUC settings */ #endif } FormData_pg_db_role_setting; diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 6a6d3293e41..8fe9b2fcfe9 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -2257,6 +2257,7 @@ typedef struct VariableSetStmt char *name; /* variable to be set */ List *args; /* List of A_Const nodes */ bool is_local; /* SET LOCAL? */ + bool user_set; } VariableSetStmt; /* ---------------------- diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h index b3aaff9665b..91cc3418547 100644 --- a/src/include/utils/guc.h +++ b/src/include/utils/guc.h @@ -391,11 +391,14 @@ extern void AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt); extern char *GetConfigOptionByName(const char *name, const char **varname, bool missing_ok); -extern void ProcessGUCArray(ArrayType *array, +extern void ProcessGUCArray(ArrayType *array, ArrayType *usersetArray, GucContext context, GucSource source, GucAction action); -extern ArrayType *GUCArrayAdd(ArrayType *array, const char *name, const char *value); -extern ArrayType *GUCArrayDelete(ArrayType *array, const char *name); -extern ArrayType *GUCArrayReset(ArrayType *array); +extern ArrayType *GUCArrayAdd(ArrayType *array, ArrayType **usersetArray, + const char *name, const char *value, + bool user_set); +extern ArrayType *GUCArrayDelete(ArrayType *array, ArrayType **usersetArray, + const char *name); +extern ArrayType *GUCArrayReset(ArrayType *array, ArrayType **usersetArray); extern void *guc_malloc(int elevel, size_t size); extern pg_nodiscard void *guc_realloc(int elevel, void *old, size_t size); |
