MCPcopy Create free account
hub / github.com/documentdb/documentdb / HandleUniqueConversion

Function HandleUniqueConversion

pg_documentdb/src/commands/coll_mod.c:993–1011  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

991
992
993static void
994HandleUniqueConversion(IndexDetails *indexDetails)
995{
996 bool isBuildAsUnique = false;
997 bool currentPrepareUnique = false;
998 GetPrepareUniqueFlagsFromOptions(
999 indexDetails->indexSpec.indexOptions, &isBuildAsUnique,
1000 &currentPrepareUnique);
1001 if (!currentPrepareUnique)
1002 {
1003 ereport(ERROR, (errcode(ERRCODE_DOCUMENTDB_INVALIDOPTIONS),
1004 errmsg(
1005 "index must be created with buildAsUnique option "
1006 " and have prepareUnique set to true to enable 'unique' operation.")));
1007 }
1008
1009 UpdatePostgresIndex(indexDetails->collectionId, indexDetails->indexId,
1010 INDEX_METADATA_UPDATE_OPERATION_UNIQUE, true);
1011}
1012
1013
1014/*

Callers 1

Calls 2

UpdatePostgresIndexFunction · 0.85

Tested by

no test coverage detected