if (**newval != '\0' &&
!OidIsValid(get_tablespace_oid(*newval, true)))
{
- GUC_check_errdetail("Tablespace \"%s\" does not exist.",
- *newval);
- return false;
+ /*
+ * 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.
+ */
+ if (source == PGC_S_TEST)
+ {
+ ereport(NOTICE,
+ (errcode(ERRCODE_UNDEFINED_OBJECT),
+ errmsg("tablespace \"%s\" does not exist",
+ *newval)));
+ }
+ else
+ {
+ GUC_check_errdetail("Tablespace \"%s\" does not exist.",
+ *newval);
+ return false;
+ }
}
}
}
/*
- * In an interactive SET command, we ereport for bad info.
- * Otherwise, silently ignore any bad list elements.
+ * 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.
*/
- curoid = get_tablespace_oid(curname, source < PGC_S_INTERACTIVE);
+ curoid = get_tablespace_oid(curname, source <= PGC_S_TEST);
if (curoid == InvalidOid)
+ {
+ if (source == PGC_S_TEST)
+ ereport(NOTICE,
+ (errcode(ERRCODE_UNDEFINED_OBJECT),
+ errmsg("tablespace \"%s\" does not exist",
+ curname)));
continue;
+ }
/*
* Allow explicit specification of database's default tablespace
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.
+ */
if (!OidIsValid(cfgId))
- return false;
+ {
+ if (source == PGC_S_TEST)
+ {
+ ereport(NOTICE,
+ (errcode(ERRCODE_UNDEFINED_OBJECT),
+ errmsg("text search configuration \"%s\" does not exist", *newval)));
+ return true;
+ }
+ else
+ return false;
+ }
/*
* Modify the actually stored value to be fully qualified, to ensure