summaryrefslogtreecommitdiff
path: root/src/backend/utils/misc/guc-file.l
diff options
context:
space:
mode:
authorTom Lane2021-04-07 15:22:22 +0000
committerTom Lane2021-04-07 15:22:22 +0000
commit3db826bd55cd1df0dd8c3d811f8e5b936d7ba1e4 (patch)
tree58aa2d1b51b3ce1e8990ab2b516f7a8be68287f4 /src/backend/utils/misc/guc-file.l
parent23607a8156d595522c232ff3933d77041d3adaa1 (diff)
Tighten up allowed names for custom GUC parameters.
Formerly we were pretty lax about what a custom GUC's name could be; so long as it had at least one dot in it, we'd take it. However, corner cases such as dashes or equal signs in the name would cause various bits of functionality to misbehave. Rather than trying to make the world perfectly safe for that, let's just require that custom names look like "identifier.identifier", where "identifier" means something that scan.l would accept without double quotes. Along the way, this patch refactors things slightly in guc.c so that find_option() is responsible for reporting GUC-not-found cases, allowing removal of duplicative code from its callers. Per report from Hubert Depesz Lubaczewski. No back-patch, since the consequences of the problem don't seem to warrant changing behavior in stable branches. Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/backend/utils/misc/guc-file.l')
-rw-r--r--src/backend/utils/misc/guc-file.l4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/utils/misc/guc-file.l b/src/backend/utils/misc/guc-file.l
index 7885a169bb9..9498bbea2f6 100644
--- a/src/backend/utils/misc/guc-file.l
+++ b/src/backend/utils/misc/guc-file.l
@@ -282,7 +282,7 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
* Try to find the variable; but do not create a custom placeholder if
* it's not there already.
*/
- record = find_option(item->name, false, elevel);
+ record = find_option(item->name, false, true, elevel);
if (record)
{
@@ -306,7 +306,7 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
/* Now mark it as present in file */
record->status |= GUC_IS_IN_FILE;
}
- else if (strchr(item->name, GUC_QUALIFIER_SEPARATOR) == NULL)
+ else if (!valid_custom_variable_name(item->name))
{
/* Invalid non-custom variable, so complain */
ereport(elevel,