* 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. */
| 296 | * the given namespace? If so, raise an appropriate error message. |
| 297 | */ |
| 298 | void |
| 299 | IsThereCollationInNamespace(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 |
no test coverage detected