MCPcopy Create free account
hub / github.com/apache/cloudberry / IsThereCollationInNamespace

Function IsThereCollationInNamespace

src/backend/commands/collationcmds.c:298–321  ·  view source on GitHub ↗

* Subroutine for ALTER COLLATION SET SCHEMA and RENAME * * Is there a collation with the same name of the given collation already in * the given namespace? If so, raise an appropriate error message. */

Source from the content-addressed store, hash-verified

296 * the given namespace? If so, raise an appropriate error message.
297 */
298void
299IsThereCollationInNamespace(const char *collname, Oid nspOid)
300{
301 /* make sure the name doesn't already exist in new schema */
302 if (SearchSysCacheExists3(COLLNAMEENCNSP,
303 CStringGetDatum(collname),
304 Int32GetDatum(GetDatabaseEncoding()),
305 ObjectIdGetDatum(nspOid)))
306 ereport(ERROR,
307 (errcode(ERRCODE_DUPLICATE_OBJECT),
308 errmsg("collation \"%s\" for encoding \"%s\" already exists in schema \"%s\"",
309 collname, GetDatabaseEncodingName(),
310 get_namespace_name(nspOid))));
311
312 /* mustn't match an any-encoding entry, either */
313 if (SearchSysCacheExists3(COLLNAMEENCNSP,
314 CStringGetDatum(collname),
315 Int32GetDatum(-1),
316 ObjectIdGetDatum(nspOid)))
317 ereport(ERROR,
318 (errcode(ERRCODE_DUPLICATE_OBJECT),
319 errmsg("collation \"%s\" already exists in schema \"%s\"",
320 collname, get_namespace_name(nspOid))));
321}
322
323/*
324 * ALTER COLLATION

Callers 2

Calls 8

CStringGetDatumFunction · 0.85
Int32GetDatumFunction · 0.85
GetDatabaseEncodingFunction · 0.85
ObjectIdGetDatumFunction · 0.85
GetDatabaseEncodingNameFunction · 0.85
get_namespace_nameFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected