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

Function ParseIndexDefDocument

pg_documentdb/src/commands/create_indexes.c:1466–1493  ·  view source on GitHub ↗

* ParseIndexDefDocument is a wrapper around ParseIndexDefDocumentInternal * that extends error messages related with DocumentDB errors that might be thrown * when parsing "indexes" field of "arg" document passed to * dbCommand/createIndexes. */

Source from the content-addressed store, hash-verified

1464 * dbCommand/createIndexes.
1465 */
1466static IndexDef *
1467ParseIndexDefDocument(const bson_iter_t *indexesArrayIter, bool ignoreUnknownIndexOptions,
1468 bool buildAsUniqueForPrepareUnique)
1469{
1470 const char *indexSpecRepr = PgbsonIterDocumentToJsonForLogging(indexesArrayIter);
1471 StringInfo errorMessagePrefixStr = makeStringInfo();
1472 appendStringInfo(errorMessagePrefixStr,
1473 "Error in specification %s:",
1474 indexSpecRepr);
1475
1476 MemoryContext savedMemoryContext = CurrentMemoryContext;
1477 IndexDef *indexDef = NULL;
1478 PG_TRY();
1479 {
1480 indexDef = ParseIndexDefDocumentInternal(indexesArrayIter,
1481 indexSpecRepr,
1482 ignoreUnknownIndexOptions,
1483 buildAsUniqueForPrepareUnique);
1484 }
1485 PG_CATCH();
1486 {
1487 MemoryContextSwitchTo(savedMemoryContext);
1488 RethrowPrependDocumentDBError(errorMessagePrefixStr->data);
1489 }
1490 PG_END_TRY();
1491
1492 return indexDef;
1493}
1494
1495
1496static bool

Callers 1

ParseCreateIndexesArgFunction · 0.85

Tested by

no test coverage detected