!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)
{
}
/*
- * 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)
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))
{
* 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.
*/