mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
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.
This commit is contained in:
parent
546f7c2e38
commit
0c66a22377
@ -977,12 +977,8 @@ check_default_tablespace(char **newval, void **extra, GucSource source)
|
||||
!OidIsValid(get_tablespace_oid(*newval, true)))
|
||||
{
|
||||
/*
|
||||
* When source == PGC_S_TEST, we are checking the argument of an
|
||||
* ALTER DATABASE SET or ALTER USER SET command. pg_dumpall dumps
|
||||
* 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.
|
||||
* When source == PGC_S_TEST, don't throw a hard error for a
|
||||
* nonexistent tablespace, only a NOTICE. See comments in guc.h.
|
||||
*/
|
||||
if (source == PGC_S_TEST)
|
||||
{
|
||||
@ -1111,14 +1107,9 @@ check_temp_tablespaces(char **newval, void **extra, GucSource source)
|
||||
}
|
||||
|
||||
/*
|
||||
* In an interactive SET command, we ereport for bad info. When
|
||||
* source == PGC_S_TEST, we are checking the argument of an ALTER
|
||||
* DATABASE SET or ALTER USER SET command. pg_dumpall dumps 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. Otherwise, silently
|
||||
* ignore any bad list elements.
|
||||
* In an interactive SET command, we ereport for bad info. When
|
||||
* source == PGC_S_TEST, don't throw a hard error for a
|
||||
* nonexistent tablespace, only a NOTICE. See comments in guc.h.
|
||||
*/
|
||||
curoid = get_tablespace_oid(curname, source <= PGC_S_TEST);
|
||||
if (curoid == InvalidOid)
|
||||
|
7
src/backend/utils/cache/ts_cache.c
vendored
7
src/backend/utils/cache/ts_cache.c
vendored
@ -604,11 +604,8 @@ check_TSCurrentConfig(char **newval, void **extra, GucSource source)
|
||||
cfgId = get_ts_config_oid(stringToQualifiedNameList(*newval), true);
|
||||
|
||||
/*
|
||||
* When source == PGC_S_TEST, we are checking the argument of an ALTER
|
||||
* DATABASE SET or ALTER USER SET command. It could be that the
|
||||
* 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.
|
||||
* When source == PGC_S_TEST, don't throw a hard error for a
|
||||
* nonexistent configuration, only a NOTICE. See comments in guc.h.
|
||||
*/
|
||||
if (!OidIsValid(cfgId))
|
||||
{
|
||||
|
@ -72,11 +72,15 @@ typedef enum
|
||||
* dividing line between "interactive" and "non-interactive" sources for
|
||||
* error reporting purposes.
|
||||
*
|
||||
* PGC_S_TEST is used when testing values to be stored as per-database or
|
||||
* per-user defaults ("doit" will always be false, so this never gets stored
|
||||
* as the actual source of any value). 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.
|
||||
* PGC_S_TEST is used when testing values to be used later ("doit" will always
|
||||
* be false, so this never gets stored as the actual source of any value).
|
||||
* For example, ALTER DATABASE/ROLE tests proposed per-database or per-user
|
||||
* defaults this way, and CREATE FUNCTION tests proposed function SET clauses
|
||||
* 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.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user