Skip to content

Commit b9a7a82

Browse files
committed
Revert "Add USER SET parameter values for pg_db_role_setting"
This reverts commit 096dd80 and its fixups beecbe8, afdd9f7, 529da08, db93e73. Catversion is bumped. Discussion: https://postgr.es/m/d46f9265-ff3c-6743-2278-6772598233c2%40pgmasters.net
1 parent 58dc80a commit b9a7a82

34 files changed

+51
-677
lines changed

doc/src/sgml/catalogs.sgml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3212,16 +3212,6 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
32123212
Defaults for run-time configuration variables
32133213
</para></entry>
32143214
</row>
3215-
3216-
<row>
3217-
<entry role="catalog_table_entry"><para role="column_definition">
3218-
<structfield>setuser</structfield> <type>bool[]</type>
3219-
</para>
3220-
<para>
3221-
Values of <link linkend="sql-alterrole-user-set"><literal>USER SET</literal></link>
3222-
flag for every setting in <structfield>setconfig</structfield>
3223-
</para></entry>
3224-
</row>
32253215
</tbody>
32263216
</tgroup>
32273217
</table>

doc/src/sgml/ref/alter_database.sgml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ ALTER DATABASE <replaceable class="parameter">name</replaceable> SET TABLESPACE
3737

3838
ALTER DATABASE <replaceable class="parameter">name</replaceable> REFRESH COLLATION VERSION
3939

40-
ALTER DATABASE <replaceable class="parameter">name</replaceable> SET <replaceable>configuration_parameter</replaceable> { TO | = } { <replaceable>value</replaceable> | <replaceable>value</replaceable> USER SET | DEFAULT }
40+
ALTER DATABASE <replaceable class="parameter">name</replaceable> SET <replaceable>configuration_parameter</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT }
4141
ALTER DATABASE <replaceable class="parameter">name</replaceable> SET <replaceable>configuration_parameter</replaceable> FROM CURRENT
4242
ALTER DATABASE <replaceable class="parameter">name</replaceable> RESET <replaceable>configuration_parameter</replaceable>
4343
ALTER DATABASE <replaceable class="parameter">name</replaceable> RESET ALL
@@ -206,19 +206,6 @@ ALTER DATABASE <replaceable class="parameter">name</replaceable> RESET ALL
206206
</para>
207207
</listitem>
208208
</varlistentry>
209-
210-
<varlistentry>
211-
<term><literal>USER SET</literal></term>
212-
<listitem>
213-
<para>
214-
Specifies that the variable should be set on behalf of an ordinary role.
215-
That allows non-superuser and non-replication roles to set placeholder
216-
variables, whose permission requirements are not known yet;
217-
see <xref linkend="runtime-config-custom"/>. The variable won't
218-
be set if it appears to require superuser privileges.
219-
</para>
220-
</listitem>
221-
</varlistentry>
222209
</variablelist>
223210
</refsect1>
224211

doc/src/sgml/ref/alter_role.sgml

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ ALTER ROLE <replaceable class="parameter">role_specification</replaceable> [ WIT
3838

3939
ALTER ROLE <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
4040

41-
ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="parameter">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> { TO | = } { <replaceable>value</replaceable> | <replaceable>value</replaceable> USER SET | DEFAULT }
41+
ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="parameter">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT }
4242
ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="parameter">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> FROM CURRENT
4343
ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="parameter">database_name</replaceable> ] RESET <replaceable>configuration_parameter</replaceable>
4444
ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="parameter">database_name</replaceable> ] RESET ALL
@@ -239,19 +239,6 @@ ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | A
239239
</para>
240240
</listitem>
241241
</varlistentry>
242-
243-
<varlistentry id="sql-alterrole-user-set">
244-
<term><literal>USER SET</literal></term>
245-
<listitem>
246-
<para>
247-
Specifies that the variable should be set on behalf of an ordinary role.
248-
That allows non-superuser and non-replication roles to set placeholder
249-
variables, whose permission requirements are not known yet;
250-
see <xref linkend="runtime-config-custom"/>. The variable won't
251-
be set if it appears to require superuser privileges.
252-
</para>
253-
</listitem>
254-
</varlistentry>
255242
</variablelist>
256243
</refsect1>
257244

@@ -347,13 +334,6 @@ ALTER ROLE worker_bee SET maintenance_work_mem = 100000;
347334

348335
<programlisting>
349336
ALTER ROLE fred IN DATABASE devel SET client_min_messages = DEBUG;
350-
</programlisting></para>
351-
352-
<para>
353-
Give a role a non-default placeholder setting on behalf of ordinary user:
354-
355-
<programlisting>
356-
ALTER ROLE fred SET my.param = 'value' USER SET;
357337
</programlisting></para>
358338
</refsect1>
359339

doc/src/sgml/ref/alter_user.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ ALTER USER <replaceable class="parameter">role_specification</replaceable> [ WIT
3838

3939
ALTER USER <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
4040

41-
ALTER USER { <replaceable class="parameter">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="parameter">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> { TO | = } { <replaceable>value</replaceable> | <replaceable>value</replaceable> USER SET | DEFAULT }
41+
ALTER USER { <replaceable class="parameter">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="parameter">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT }
4242
ALTER USER { <replaceable class="parameter">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="parameter">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> FROM CURRENT
4343
ALTER USER { <replaceable class="parameter">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="parameter">database_name</replaceable> ] RESET <replaceable>configuration_parameter</replaceable>
4444
ALTER USER { <replaceable class="parameter">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="parameter">database_name</replaceable> ] RESET ALL

doc/src/sgml/ref/psql-ref.sgml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,13 +1902,6 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
19021902
commands are used to define per-role and per-database configuration
19031903
settings.
19041904
</para>
1905-
1906-
<para>
1907-
Since <productname>PostgreSQL</productname> 16, the output includes a
1908-
column with the values of the
1909-
<link linkend="sql-alterrole-user-set"><literal>USER SET</literal></link>
1910-
flag for each setting.
1911-
</para>
19121905
</listitem>
19131906
</varlistentry>
19141907

src/backend/catalog/pg_db_role_setting.c

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,14 @@ AlterSetting(Oid databaseid, Oid roleid, VariableSetStmt *setstmt)
6363
if (HeapTupleIsValid(tuple))
6464
{
6565
ArrayType *new = NULL;
66-
ArrayType *usersetArray;
6766
Datum datum;
68-
Datum usersetDatum;
6967
bool isnull;
70-
bool usersetIsnull;
7168

7269
datum = heap_getattr(tuple, Anum_pg_db_role_setting_setconfig,
7370
RelationGetDescr(rel), &isnull);
74-
usersetDatum = heap_getattr(tuple, Anum_pg_db_role_setting_setuser,
75-
RelationGetDescr(rel), &usersetIsnull);
7671

7772
if (!isnull)
78-
{
79-
Assert(!usersetIsnull);
80-
usersetArray = DatumGetArrayTypeP(usersetDatum);
81-
new = GUCArrayReset(DatumGetArrayTypeP(datum), &usersetArray);
82-
}
73+
new = GUCArrayReset(DatumGetArrayTypeP(datum));
8374

8475
if (new)
8576
{
@@ -95,11 +86,6 @@ AlterSetting(Oid databaseid, Oid roleid, VariableSetStmt *setstmt)
9586
repl_repl[Anum_pg_db_role_setting_setconfig - 1] = true;
9687
repl_null[Anum_pg_db_role_setting_setconfig - 1] = false;
9788

98-
repl_val[Anum_pg_db_role_setting_setuser - 1] =
99-
PointerGetDatum(usersetArray);
100-
repl_repl[Anum_pg_db_role_setting_setuser - 1] = true;
101-
repl_null[Anum_pg_db_role_setting_setuser - 1] = false;
102-
10389
newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel),
10490
repl_val, repl_null, repl_repl);
10591
CatalogTupleUpdate(rel, &tuple->t_self, newtuple);
@@ -115,39 +101,28 @@ AlterSetting(Oid databaseid, Oid roleid, VariableSetStmt *setstmt)
115101
bool repl_repl[Natts_pg_db_role_setting];
116102
HeapTuple newtuple;
117103
Datum datum;
118-
Datum usersetDatum;
119104
bool isnull;
120-
bool usersetIsnull;
121105
ArrayType *a;
122-
ArrayType *usersetArray;
123106

124107
memset(repl_repl, false, sizeof(repl_repl));
125108
repl_repl[Anum_pg_db_role_setting_setconfig - 1] = true;
126109
repl_null[Anum_pg_db_role_setting_setconfig - 1] = false;
127-
repl_repl[Anum_pg_db_role_setting_setuser - 1] = true;
128-
repl_null[Anum_pg_db_role_setting_setuser - 1] = false;
129110

130-
/* Extract old values of setconfig and setuser */
111+
/* Extract old value of setconfig */
131112
datum = heap_getattr(tuple, Anum_pg_db_role_setting_setconfig,
132113
RelationGetDescr(rel), &isnull);
133114
a = isnull ? NULL : DatumGetArrayTypeP(datum);
134115

135-
usersetDatum = heap_getattr(tuple, Anum_pg_db_role_setting_setuser,
136-
RelationGetDescr(rel), &usersetIsnull);
137-
usersetArray = usersetIsnull ? NULL : DatumGetArrayTypeP(usersetDatum);
138-
139116
/* Update (valuestr is NULL in RESET cases) */
140117
if (valuestr)
141-
a = GUCArrayAdd(a, &usersetArray, setstmt->name, valuestr, setstmt->user_set);
118+
a = GUCArrayAdd(a, setstmt->name, valuestr);
142119
else
143-
a = GUCArrayDelete(a, &usersetArray, setstmt->name);
120+
a = GUCArrayDelete(a, setstmt->name);
144121

145122
if (a)
146123
{
147124
repl_val[Anum_pg_db_role_setting_setconfig - 1] =
148125
PointerGetDatum(a);
149-
repl_val[Anum_pg_db_role_setting_setuser - 1] =
150-
PointerGetDatum(usersetArray);
151126

152127
newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel),
153128
repl_val, repl_null, repl_repl);
@@ -162,18 +137,16 @@ AlterSetting(Oid databaseid, Oid roleid, VariableSetStmt *setstmt)
162137
HeapTuple newtuple;
163138
Datum values[Natts_pg_db_role_setting];
164139
bool nulls[Natts_pg_db_role_setting];
165-
ArrayType *a,
166-
*usersetArray;
140+
ArrayType *a;
167141

168142
memset(nulls, false, sizeof(nulls));
169143

170-
a = GUCArrayAdd(NULL, &usersetArray, setstmt->name, valuestr, setstmt->user_set);
144+
a = GUCArrayAdd(NULL, setstmt->name, valuestr);
171145

172146
values[Anum_pg_db_role_setting_setdatabase - 1] =
173147
ObjectIdGetDatum(databaseid);
174148
values[Anum_pg_db_role_setting_setrole - 1] = ObjectIdGetDatum(roleid);
175149
values[Anum_pg_db_role_setting_setconfig - 1] = PointerGetDatum(a);
176-
values[Anum_pg_db_role_setting_setuser - 1] = PointerGetDatum(usersetArray);
177150
newtuple = heap_form_tuple(RelationGetDescr(rel), values, nulls);
178151

179152
CatalogTupleInsert(rel, newtuple);
@@ -267,25 +240,20 @@ ApplySetting(Snapshot snapshot, Oid databaseid, Oid roleid,
267240
while (HeapTupleIsValid(tup = systable_getnext(scan)))
268241
{
269242
bool isnull;
270-
bool usersetIsnull;
271243
Datum datum;
272-
Datum usersetDatum;
273244

274245
datum = heap_getattr(tup, Anum_pg_db_role_setting_setconfig,
275246
RelationGetDescr(relsetting), &isnull);
276-
usersetDatum = heap_getattr(tup, Anum_pg_db_role_setting_setuser,
277-
RelationGetDescr(relsetting), &usersetIsnull);
278247
if (!isnull)
279248
{
280249
ArrayType *a = DatumGetArrayTypeP(datum);
281-
ArrayType *usersetArray = DatumGetArrayTypeP(usersetDatum);
282250

283251
/*
284252
* We process all the options at SUSET level. We assume that the
285253
* right to insert an option into pg_db_role_setting was checked
286254
* when it was inserted.
287255
*/
288-
ProcessGUCArray(a, usersetArray, PGC_SUSET, source, GUC_ACTION_SET);
256+
ProcessGUCArray(a, PGC_SUSET, source, GUC_ACTION_SET);
289257
}
290258
}
291259

src/backend/catalog/pg_proc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,6 @@ ProcedureCreate(const char *procedureName,
696696
{
697697
save_nestlevel = NewGUCNestLevel();
698698
ProcessGUCArray(set_items,
699-
NULL,
700699
(superuser() ? PGC_SUSET : PGC_USERSET),
701700
PGC_S_SESSION,
702701
GUC_ACTION_SAVE);

src/backend/commands/functioncmds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,9 +662,9 @@ update_proconfig_value(ArrayType *a, List *set_items)
662662
char *valuestr = ExtractSetVariableArgs(sstmt);
663663

664664
if (valuestr)
665-
a = GUCArrayAdd(a, NULL, sstmt->name, valuestr, sstmt->user_set);
665+
a = GUCArrayAdd(a, sstmt->name, valuestr);
666666
else /* RESET */
667-
a = GUCArrayDelete(a, NULL, sstmt->name);
667+
a = GUCArrayDelete(a, sstmt->name);
668668
}
669669
}
670670

src/backend/parser/gram.y

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,26 +1648,6 @@ generic_set:
16481648
n->args = $3;
16491649
$$ = n;
16501650
}
1651-
| var_name TO var_list USER SET
1652-
{
1653-
VariableSetStmt *n = makeNode(VariableSetStmt);
1654-
1655-
n->kind = VAR_SET_VALUE;
1656-
n->name = $1;
1657-
n->args = $3;
1658-
n->user_set = true;
1659-
$$ = n;
1660-
}
1661-
| var_name '=' var_list USER SET
1662-
{
1663-
VariableSetStmt *n = makeNode(VariableSetStmt);
1664-
1665-
n->kind = VAR_SET_VALUE;
1666-
n->name = $1;
1667-
n->args = $3;
1668-
n->user_set = true;
1669-
$$ = n;
1670-
}
16711651
| var_name TO DEFAULT
16721652
{
16731653
VariableSetStmt *n = makeNode(VariableSetStmt);

src/backend/utils/adt/arrayfuncs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3367,7 +3367,6 @@ construct_array_builtin(Datum *elems, int nelems, Oid elmtype)
33673367
switch (elmtype)
33683368
{
33693369
case CHAROID:
3370-
case BOOLOID:
33713370
elmlen = 1;
33723371
elmbyval = true;
33733372
elmalign = TYPALIGN_CHAR;

src/backend/utils/fmgr/fmgr.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,6 @@ fmgr_security_definer(PG_FUNCTION_ARGS)
692692
if (fcache->proconfig)
693693
{
694694
ProcessGUCArray(fcache->proconfig,
695-
NULL,
696695
(superuser() ? PGC_SUSET : PGC_USERSET),
697696
PGC_S_SESSION,
698697
GUC_ACTION_SAVE);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy