Skip to content

Commit a486e35

Browse files
committed
Add pg_settings.pending_restart column
with input from David G. Johnston, Robert Haas, Michael Paquier
1 parent 333a870 commit a486e35

File tree

6 files changed

+29
-5
lines changed

6 files changed

+29
-5
lines changed

doc/src/sgml/catalogs.sgml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9042,6 +9042,14 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
90429042
or when examined by a non-superuser)
90439043
</entry>
90449044
</row>
9045+
<row>
9046+
<entry><structfield>pending_restart</structfield></entry>
9047+
<entry><type>boolean</type></entry>
9048+
<entry><literal>true</literal> if the value has been changed in the
9049+
configuration file but needs a restart; or <literal>false</literal>
9050+
otherwise.
9051+
</entry>
9052+
</row>
90459053
</tbody>
90469054
</tgroup>
90479055
</table>

src/backend/utils/misc/guc.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5927,12 +5927,14 @@ set_config_option(const char *name, const char *value,
59275927
{
59285928
if (*conf->variable != newval)
59295929
{
5930+
record->status |= GUC_PENDING_RESTART;
59305931
ereport(elevel,
59315932
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
59325933
errmsg("parameter \"%s\" cannot be changed without restarting the server",
59335934
name)));
59345935
return 0;
59355936
}
5937+
record->status &= ~GUC_PENDING_RESTART;
59365938
return -1;
59375939
}
59385940

@@ -6015,12 +6017,14 @@ set_config_option(const char *name, const char *value,
60156017
{
60166018
if (*conf->variable != newval)
60176019
{
6020+
record->status |= GUC_PENDING_RESTART;
60186021
ereport(elevel,
60196022
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
60206023
errmsg("parameter \"%s\" cannot be changed without restarting the server",
60216024
name)));
60226025
return 0;
60236026
}
6027+
record->status &= ~GUC_PENDING_RESTART;
60246028
return -1;
60256029
}
60266030

@@ -6103,12 +6107,14 @@ set_config_option(const char *name, const char *value,
61036107
{
61046108
if (*conf->variable != newval)
61056109
{
6110+
record->status |= GUC_PENDING_RESTART;
61066111
ereport(elevel,
61076112
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
61086113
errmsg("parameter \"%s\" cannot be changed without restarting the server",
61096114
name)));
61106115
return 0;
61116116
}
6117+
record->status &= ~GUC_PENDING_RESTART;
61126118
return -1;
61136119
}
61146120

@@ -6209,12 +6215,14 @@ set_config_option(const char *name, const char *value,
62096215
if (*conf->variable == NULL || newval == NULL ||
62106216
strcmp(*conf->variable, newval) != 0)
62116217
{
6218+
record->status |= GUC_PENDING_RESTART;
62126219
ereport(elevel,
62136220
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
62146221
errmsg("parameter \"%s\" cannot be changed without restarting the server",
62156222
name)));
62166223
return 0;
62176224
}
6225+
record->status &= ~GUC_PENDING_RESTART;
62186226
return -1;
62196227
}
62206228

@@ -6302,12 +6310,14 @@ set_config_option(const char *name, const char *value,
63026310
{
63036311
if (*conf->variable != newval)
63046312
{
6313+
record->status |= GUC_PENDING_RESTART;
63056314
ereport(elevel,
63066315
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
63076316
errmsg("parameter \"%s\" cannot be changed without restarting the server",
63086317
name)));
63096318
return 0;
63106319
}
6320+
record->status &= ~GUC_PENDING_RESTART;
63116321
return -1;
63126322
}
63136323

@@ -8009,6 +8019,8 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow)
80098019
values[14] = NULL;
80108020
values[15] = NULL;
80118021
}
8022+
8023+
values[16] = (conf->status & GUC_PENDING_RESTART) ? "t" : "f";
80128024
}
80138025

80148026
/*
@@ -8044,7 +8056,7 @@ show_config_by_name(PG_FUNCTION_ARGS)
80448056
* show_all_settings - equiv to SHOW ALL command but implemented as
80458057
* a Table Function.
80468058
*/
8047-
#define NUM_PG_SETTINGS_ATTS 16
8059+
#define NUM_PG_SETTINGS_ATTS 17
80488060

80498061
Datum
80508062
show_all_settings(PG_FUNCTION_ARGS)
@@ -8104,6 +8116,8 @@ show_all_settings(PG_FUNCTION_ARGS)
81048116
TEXTOID, -1, 0);
81058117
TupleDescInitEntry(tupdesc, (AttrNumber) 16, "sourceline",
81068118
INT4OID, -1, 0);
8119+
TupleDescInitEntry(tupdesc, (AttrNumber) 17, "pending_restart",
8120+
BOOLOID, -1, 0);
81078121

81088122
/*
81098123
* Generate attribute metadata needed later to produce tuples from raw

src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 201505121
56+
#define CATALOG_VERSION_NO 201505141
5757

5858
#endif

src/include/catalog/pg_proc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3067,7 +3067,7 @@ DATA(insert OID = 2077 ( current_setting PGNSP PGUID 12 1 0 0 0 f f f f t f s 1
30673067
DESCR("SHOW X as a function");
30683068
DATA(insert OID = 2078 ( set_config PGNSP PGUID 12 1 0 0 0 f f f f f f v 3 0 25 "25 25 16" _null_ _null_ _null_ _null_ _null_ set_config_by_name _null_ _null_ _null_ ));
30693069
DESCR("SET X as a function");
3070-
DATA(insert OID = 2084 ( pg_show_all_settings PGNSP PGUID 12 1 1000 0 0 f f f f t t s 0 0 2249 "" "{25,25,25,25,25,25,25,25,25,25,25,1009,25,25,25,23}" "{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}" "{name,setting,unit,category,short_desc,extra_desc,context,vartype,source,min_val,max_val,enumvals,boot_val,reset_val,sourcefile,sourceline}" _null_ _null_ show_all_settings _null_ _null_ _null_ ));
3070+
DATA(insert OID = 2084 ( pg_show_all_settings PGNSP PGUID 12 1 1000 0 0 f f f f t t s 0 0 2249 "" "{25,25,25,25,25,25,25,25,25,25,25,1009,25,25,25,23,16}" "{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}" "{name,setting,unit,category,short_desc,extra_desc,context,vartype,source,min_val,max_val,enumvals,boot_val,reset_val,sourcefile,sourceline,pending_restart}" _null_ _null_ show_all_settings _null_ _null_ _null_ ));
30713071
DESCR("SHOW ALL as a function");
30723072
DATA(insert OID = 3329 ( pg_show_all_file_settings PGNSP PGUID 12 1 1000 0 0 f f f f t t s 0 0 2249 "" "{25,23,23,25,25}" "{o,o,o,o,o}" "{sourcefile,sourceline,seqno,name,setting}" _null_ _null_ show_all_file_settings _null_ _null_ _null_ ));
30733073
DESCR("show config file settings");

src/include/utils/guc_tables.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ struct config_generic
167167
* Caution: the GUC_IS_IN_FILE bit is transient state for ProcessConfigFile.
168168
* Do not assume that its value represents useful information elsewhere.
169169
*/
170+
#define GUC_PENDING_RESTART 0x0002
170171

171172

172173
/* GUC records for specific variable types */

src/test/regress/expected/rules.out

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,8 +1616,9 @@ pg_settings| SELECT a.name,
16161616
a.boot_val,
16171617
a.reset_val,
16181618
a.sourcefile,
1619-
a.sourceline
1620-
FROM pg_show_all_settings() a(name, setting, unit, category, short_desc, extra_desc, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, sourcefile, sourceline);
1619+
a.sourceline,
1620+
a.pending_restart
1621+
FROM pg_show_all_settings() a(name, setting, unit, category, short_desc, extra_desc, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, sourcefile, sourceline, pending_restart);
16211622
pg_shadow| SELECT pg_authid.rolname AS usename,
16221623
pg_authid.oid AS usesysid,
16231624
pg_authid.rolcreatedb AS usecreatedb,

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