Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0c66a22

Browse files
committed
Update comments concerning PGC_S_TEST.
This GUC context value was once only used by ALTER DATABASE SET andALTER USER SET. That's not true anymore, though, so rewrite thecomments to be a bit more general.Patch in HEAD only, since this is just an internal documentation issue.
1 parent546f7c2 commit0c66a22

File tree

3 files changed

+16
-24
lines changed

3 files changed

+16
-24
lines changed

‎src/backend/commands/tablespace.c

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -977,12 +977,8 @@ check_default_tablespace(char **newval, void **extra, GucSource source)
977977
!OidIsValid(get_tablespace_oid(*newval, true)))
978978
{
979979
/*
980-
* When source == PGC_S_TEST, we are checking the argument of an
981-
* ALTER DATABASE SET or ALTER USER SET command. pg_dumpall dumps
982-
* all roles before tablespaces, so if we're restoring a
983-
* pg_dumpall script the tablespace might not yet exist, but will
984-
* be created later. Because of that, issue a NOTICE if source ==
985-
* PGC_S_TEST, but accept the value anyway.
980+
* When source == PGC_S_TEST, don't throw a hard error for a
981+
* nonexistent tablespace, only a NOTICE. See comments in guc.h.
986982
*/
987983
if (source==PGC_S_TEST)
988984
{
@@ -1111,14 +1107,9 @@ check_temp_tablespaces(char **newval, void **extra, GucSource source)
11111107
}
11121108

11131109
/*
1114-
* In an interactive SET command, we ereport for bad info.When
1115-
* source == PGC_S_TEST, we are checking the argument of an ALTER
1116-
* DATABASE SET or ALTER USER SET command.pg_dumpall dumps all
1117-
* roles before tablespaces, so if we're restoring a pg_dumpall
1118-
* script the tablespace might not yet exist, but will be created
1119-
* later. Because of that, issue a NOTICE if source ==
1120-
* PGC_S_TEST, but accept the value anyway. Otherwise, silently
1121-
* ignore any bad list elements.
1110+
* In an interactive SET command, we ereport for bad info. When
1111+
* source == PGC_S_TEST, don't throw a hard error for a
1112+
* nonexistent tablespace, only a NOTICE. See comments in guc.h.
11221113
*/
11231114
curoid=get_tablespace_oid(curname,source <=PGC_S_TEST);
11241115
if (curoid==InvalidOid)

‎src/backend/utils/cache/ts_cache.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -604,11 +604,8 @@ check_TSCurrentConfig(char **newval, void **extra, GucSource source)
604604
cfgId=get_ts_config_oid(stringToQualifiedNameList(*newval), true);
605605

606606
/*
607-
* When source == PGC_S_TEST, we are checking the argument of an ALTER
608-
* DATABASE SET or ALTER USER SET command.It could be that the
609-
* intended use of the setting is for some other database, so we
610-
* should not error out if the text search configuration is not
611-
* present in the current database. We issue a NOTICE instead.
607+
* When source == PGC_S_TEST, don't throw a hard error for a
608+
* nonexistent configuration, only a NOTICE. See comments in guc.h.
612609
*/
613610
if (!OidIsValid(cfgId))
614611
{

‎src/include/utils/guc.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,15 @@ typedef enum
7272
* dividing line between "interactive" and "non-interactive" sources for
7373
* error reporting purposes.
7474
*
75-
* PGC_S_TEST is used when testing values to be stored as per-database or
76-
* per-user defaults ("doit" will always be false, so this never gets stored
77-
* as the actual source of any value).This is an interactive case, but
78-
* it needs its own source value because some assign hooks need to make
79-
* different validity checks in this case.
75+
* PGC_S_TEST is used when testing values to be used later ("doit" will always
76+
* be false, so this never gets stored as the actual source of any value).
77+
* For example, ALTER DATABASE/ROLE tests proposed per-database or per-user
78+
* defaults this way, and CREATE FUNCTION tests proposed function SET clauses
79+
* this way. This is an interactive case, but it needs its own source value
80+
* because some assign hooks need to make different validity checks in this
81+
* case. In particular, references to nonexistent database objects generally
82+
* shouldn't throw hard errors in this case, at most NOTICEs, since the
83+
* objects might exist by the time the setting is used for real.
8084
*
8185
* NB: see GucSource_Names in guc.c if you change this.
8286
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp