* 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. */
| 1464 | * dbCommand/createIndexes. |
| 1465 | */ |
| 1466 | static IndexDef * |
| 1467 | ParseIndexDefDocument(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 | |
| 1496 | static bool |
no test coverage detected