/* check that the locales can be loaded */
CommandCounterIncrement();
- pg_newlocale_from_collation(newoid);
+ (void) pg_newlocale_from_collation(newoid);
}
/*
if (!OidIsValid(attcollation))
ereport(ERROR,
(errcode(ERRCODE_INDETERMINATE_COLLATION),
- errmsg("no collation was derived for the index expression"),
+ errmsg("could not determine which collation to use for index expression"),
errhint("Use the COLLATE clause to set the collation explicitly.")));
}
else
if (!OidIsValid(def->collOid))
ereport(ERROR,
(errcode(ERRCODE_INDETERMINATE_COLLATION),
- errmsg("no collation was derived for view column \"%s\"",
+ errmsg("could not determine which collation to use for view column \"%s\"",
def->colname),
errhint("Use the COLLATE clause to set the collation explicitly.")));
}
size_t result_size;
if (collid != DEFAULT_COLLATION_OID)
+ {
+ if (!OidIsValid(collid))
+ {
+ /*
+ * This typically means that the parser could not resolve a
+ * conflict of implicit collations, so report it that way.
+ */
+ ereport(ERROR,
+ (errcode(ERRCODE_INDETERMINATE_COLLATION),
+ errmsg("could not determine which collation to use for lower() function"),
+ errhint("Use the COLLATE clause to set the collation explicitly.")));
+ }
mylocale = pg_newlocale_from_collation(collid);
+ }
/* Overflow paranoia */
if ((nbytes + 1) > (INT_MAX / sizeof(wchar_t)))
char *p;
if (collid != DEFAULT_COLLATION_OID)
+ {
+ if (!OidIsValid(collid))
+ {
+ /*
+ * This typically means that the parser could not resolve a
+ * conflict of implicit collations, so report it that way.
+ */
+ ereport(ERROR,
+ (errcode(ERRCODE_INDETERMINATE_COLLATION),
+ errmsg("could not determine which collation to use for lower() function"),
+ errhint("Use the COLLATE clause to set the collation explicitly.")));
+ }
mylocale = pg_newlocale_from_collation(collid);
+ }
result = pnstrdup(buff, nbytes);
size_t result_size;
if (collid != DEFAULT_COLLATION_OID)
+ {
+ if (!OidIsValid(collid))
+ {
+ /*
+ * This typically means that the parser could not resolve a
+ * conflict of implicit collations, so report it that way.
+ */
+ ereport(ERROR,
+ (errcode(ERRCODE_INDETERMINATE_COLLATION),
+ errmsg("could not determine which collation to use for upper() function"),
+ errhint("Use the COLLATE clause to set the collation explicitly.")));
+ }
mylocale = pg_newlocale_from_collation(collid);
+ }
/* Overflow paranoia */
if ((nbytes + 1) > (INT_MAX / sizeof(wchar_t)))
char *p;
if (collid != DEFAULT_COLLATION_OID)
+ {
+ if (!OidIsValid(collid))
+ {
+ /*
+ * This typically means that the parser could not resolve a
+ * conflict of implicit collations, so report it that way.
+ */
+ ereport(ERROR,
+ (errcode(ERRCODE_INDETERMINATE_COLLATION),
+ errmsg("could not determine which collation to use for upper() function"),
+ errhint("Use the COLLATE clause to set the collation explicitly.")));
+ }
mylocale = pg_newlocale_from_collation(collid);
+ }
result = pnstrdup(buff, nbytes);
size_t result_size;
if (collid != DEFAULT_COLLATION_OID)
+ {
+ if (!OidIsValid(collid))
+ {
+ /*
+ * This typically means that the parser could not resolve a
+ * conflict of implicit collations, so report it that way.
+ */
+ ereport(ERROR,
+ (errcode(ERRCODE_INDETERMINATE_COLLATION),
+ errmsg("could not determine which collation to use for initcap() function"),
+ errhint("Use the COLLATE clause to set the collation explicitly.")));
+ }
mylocale = pg_newlocale_from_collation(collid);
+ }
/* Overflow paranoia */
if ((nbytes + 1) > (INT_MAX / sizeof(wchar_t)))
char *p;
if (collid != DEFAULT_COLLATION_OID)
+ {
+ if (!OidIsValid(collid))
+ {
+ /*
+ * This typically means that the parser could not resolve a
+ * conflict of implicit collations, so report it that way.
+ */
+ ereport(ERROR,
+ (errcode(ERRCODE_INDETERMINATE_COLLATION),
+ errmsg("could not determine which collation to use for initcap() function"),
+ errhint("Use the COLLATE clause to set the collation explicitly.")));
+ }
mylocale = pg_newlocale_from_collation(collid);
+ }
result = pnstrdup(buff, nbytes);
{
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)
pg_locale_t mylocale = 0;
if (collid != DEFAULT_COLLATION_OID)
+ {
+ if (!OidIsValid(collid))
+ {
+ /*
+ * This typically means that the parser could not resolve a
+ * conflict of implicit collations, so report it that way.
+ */
+ ereport(ERROR,
+ (errcode(ERRCODE_INDETERMINATE_COLLATION),
+ errmsg("could not determine which collation to use for string comparison"),
+ errhint("Use the COLLATE clause to set the collation explicitly.")));
+ }
mylocale = pg_newlocale_from_collation(collid);
+ }
#ifdef WIN32
/* Win32 does not have UTF-8, so we need to map to UTF-16 */
(3 rows)
SELECT a, b FROM collate_test1 UNION ALL SELECT a, b FROM collate_test3 ORDER BY 2; -- fail
-ERROR: locale operation to be invoked, but no collation was derived
+ERROR: could not determine which collation to use for string comparison
+HINT: Use the COLLATE clause to set the collation explicitly.
SELECT a, b FROM collate_test1 UNION ALL SELECT a, b FROM collate_test3; -- ok
a | b
---+-----
HINT: Use the COLLATE clause to set the collation explicitly.
-- ideally this would be a parse-time error, but for now it must be run-time:
select x < y from collate_test10; -- fail
-ERROR: locale operation to be invoked, but no collation was derived
+ERROR: could not determine which collation to use for string comparison
+HINT: Use the COLLATE clause to set the collation explicitly.
select x || y from collate_test10; -- ok, because || is not collation aware
?column?
----------
(3 rows)
SELECT a, b FROM collate_test1 UNION ALL SELECT a, b FROM collate_test2 ORDER BY 2; -- fail
-ERROR: locale operation to be invoked, but no collation was derived
+ERROR: could not determine which collation to use for string comparison
+HINT: Use the COLLATE clause to set the collation explicitly.
SELECT a, b FROM collate_test1 UNION ALL SELECT a, b FROM collate_test2; -- ok
a | b
---+-----
HINT: Use the COLLATE clause to set the collation explicitly.
-- ideally this would be a parse-time error, but for now it must be run-time:
select x < y from collate_test10; -- fail
-ERROR: locale operation to be invoked, but no collation was derived
+ERROR: could not determine which collation to use for string comparison
+HINT: Use the COLLATE clause to set the collation explicitly.
select x || y from collate_test10; -- ok, because || is not collation aware
?column?
----------