Skip to content
Snippets Groups Projects
Commit 0c66a223 authored by Tom Lane's avatar Tom Lane
Browse files

Update comments concerning PGC_S_TEST.

This GUC context value was once only used by ALTER DATABASE SET and
ALTER USER SET.  That's not true anymore, though, so rewrite the
comments to be a bit more general.

Patch in HEAD only, since this is just an internal documentation issue.
parent 546f7c2e
No related branches found
No related tags found
No related merge requests found
...@@ -977,12 +977,8 @@ check_default_tablespace(char **newval, void **extra, GucSource source) ...@@ -977,12 +977,8 @@ check_default_tablespace(char **newval, void **extra, GucSource source)
!OidIsValid(get_tablespace_oid(*newval, true))) !OidIsValid(get_tablespace_oid(*newval, true)))
{ {
/* /*
* When source == PGC_S_TEST, we are checking the argument of an * When source == PGC_S_TEST, don't throw a hard error for a
* ALTER DATABASE SET or ALTER USER SET command. pg_dumpall dumps * nonexistent tablespace, only a NOTICE. See comments in guc.h.
* all roles before tablespaces, so if we're restoring a
* pg_dumpall script the tablespace might not yet exist, but will
* be created later. Because of that, issue a NOTICE if source ==
* PGC_S_TEST, but accept the value anyway.
*/ */
if (source == PGC_S_TEST) if (source == PGC_S_TEST)
{ {
...@@ -1111,14 +1107,9 @@ check_temp_tablespaces(char **newval, void **extra, GucSource source) ...@@ -1111,14 +1107,9 @@ check_temp_tablespaces(char **newval, void **extra, GucSource source)
} }
/* /*
* In an interactive SET command, we ereport for bad info. When * In an interactive SET command, we ereport for bad info. When
* source == PGC_S_TEST, we are checking the argument of an ALTER * source == PGC_S_TEST, don't throw a hard error for a
* DATABASE SET or ALTER USER SET command. pg_dumpall dumps all * nonexistent tablespace, only a NOTICE. See comments in guc.h.
* roles before tablespaces, so if we're restoring a pg_dumpall
* script the tablespace might not yet exist, but will be created
* later. Because of that, issue a NOTICE if source ==
* PGC_S_TEST, but accept the value anyway. Otherwise, silently
* ignore any bad list elements.
*/ */
curoid = get_tablespace_oid(curname, source <= PGC_S_TEST); curoid = get_tablespace_oid(curname, source <= PGC_S_TEST);
if (curoid == InvalidOid) if (curoid == InvalidOid)
......
...@@ -604,11 +604,8 @@ check_TSCurrentConfig(char **newval, void **extra, GucSource source) ...@@ -604,11 +604,8 @@ check_TSCurrentConfig(char **newval, void **extra, GucSource source)
cfgId = get_ts_config_oid(stringToQualifiedNameList(*newval), true); cfgId = get_ts_config_oid(stringToQualifiedNameList(*newval), true);
/* /*
* When source == PGC_S_TEST, we are checking the argument of an ALTER * When source == PGC_S_TEST, don't throw a hard error for a
* DATABASE SET or ALTER USER SET command. It could be that the * nonexistent configuration, only a NOTICE. See comments in guc.h.
* intended use of the setting is for some other database, so we
* should not error out if the text search configuration is not
* present in the current database. We issue a NOTICE instead.
*/ */
if (!OidIsValid(cfgId)) if (!OidIsValid(cfgId))
{ {
......
...@@ -72,11 +72,15 @@ typedef enum ...@@ -72,11 +72,15 @@ typedef enum
* dividing line between "interactive" and "non-interactive" sources for * dividing line between "interactive" and "non-interactive" sources for
* error reporting purposes. * error reporting purposes.
* *
* PGC_S_TEST is used when testing values to be stored as per-database or * PGC_S_TEST is used when testing values to be used later ("doit" will always
* per-user defaults ("doit" will always be false, so this never gets stored * be false, so this never gets stored as the actual source of any value).
* as the actual source of any value). This is an interactive case, but * For example, ALTER DATABASE/ROLE tests proposed per-database or per-user
* it needs its own source value because some assign hooks need to make * defaults this way, and CREATE FUNCTION tests proposed function SET clauses
* different validity checks in this case. * this way. This is an interactive case, but it needs its own source value
* because some assign hooks need to make different validity checks in this
* case. In particular, references to nonexistent database objects generally
* shouldn't throw hard errors in this case, at most NOTICEs, since the
* objects might exist by the time the setting is used for real.
* *
* NB: see GucSource_Names in guc.c if you change this. * NB: see GucSource_Names in guc.c if you change this.
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment