From 5233dc15cf08afc0ddece24cc0f308582bf34c18 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 28 Dec 2007 00:23:23 +0000 Subject: Improve consistency of error reporting in GUC assign_hook routines. Some were reporting ERROR for interactive assignments and LOG for other cases, some were saying nothing for non-interactive cases, and a few did yet other things. Make them use a new function GUC_complaint_elevel() to establish a reasonably uniform policy about how to report. There are still a few edge cases such as assign_search_path(), but it's much better than before. Per gripe from Devrim Gunduz and subsequent discussion. As noted by Alvaro, it'd be better to fold these custom messages into the standard "invalid parameter value" complaint from guc.c, perhaps as the DETAIL field. However that will require more redesign than seems prudent for 8.3. This is a relatively safe, low-impact change that we can afford to risk now. --- src/backend/commands/tablespace.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/backend/commands/tablespace.c') diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c index b212fe0823e..5b5c23dafe0 100644 --- a/src/backend/commands/tablespace.c +++ b/src/backend/commands/tablespace.c @@ -37,7 +37,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.51 2007/11/15 21:14:34 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.52 2007/12/28 00:23:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -923,11 +923,10 @@ assign_default_tablespace(const char *newval, bool doit, GucSource source) if (newval[0] != '\0' && !OidIsValid(get_tablespace_oid(newval))) { - if (source >= PGC_S_INTERACTIVE) - ereport(ERROR, - (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("tablespace \"%s\" does not exist", - newval))); + ereport(GUC_complaint_elevel(source), + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("tablespace \"%s\" does not exist", + newval))); return NULL; } } -- cgit v1.2.3