From 6e197cb2e537880f36828a6c55d0f6df5bf7daa8 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 22 Mar 2011 16:55:32 -0400 Subject: Improve reporting of run-time-detected indeterminate-collation errors. pg_newlocale_from_collation does not have enough context to give an error message that's even a little bit useful, so move the responsibility for complaining up to its callers. Also, reword ERRCODE_INDETERMINATE_COLLATION error messages in a less jargony, more message-style-guide-compliant fashion. --- src/backend/utils/adt/pg_locale.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src/backend/utils/adt/pg_locale.c') diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c index 15d347c4f89..163856d5b18 100644 --- a/src/backend/utils/adt/pg_locale.c +++ b/src/backend/utils/adt/pg_locale.c @@ -932,21 +932,13 @@ pg_newlocale_from_collation(Oid collid) { collation_cache_entry *cache_entry; + /* Callers must pass a valid OID */ + Assert(OidIsValid(collid)); + /* Return 0 for "default" collation, just in case caller forgets */ if (collid == DEFAULT_COLLATION_OID) return (pg_locale_t) 0; - /* - * This is where we'll fail if a collation-aware function is invoked - * and no collation OID is passed. This typically means that the - * parser could not resolve a conflict of implicit collations, so - * report it that way. - */ - if (!OidIsValid(collid)) - ereport(ERROR, - (errcode(ERRCODE_INDETERMINATE_COLLATION), - errmsg("locale operation to be invoked, but no collation was derived"))); - cache_entry = lookup_collation_cache(collid, false); if (cache_entry->locale == 0) -- cgit v1.2.3