* Converts a pgbson structure to an extended json * syntax string. */
| 442 | * syntax string. |
| 443 | */ |
| 444 | const char * |
| 445 | PgbsonToCanonicalExtendedJson(const pgbson *bsonDocument) |
| 446 | { |
| 447 | bson_t bson; |
| 448 | if (!bson_init_static(&bson, (const uint8_t *) VARDATA_ANY(bsonDocument), |
| 449 | VARSIZE_ANY_EXHDR(bsonDocument))) |
| 450 | { |
| 451 | ereport(ERROR, (errcode(ERRCODE_DOCUMENTDB_BADVALUE), |
| 452 | errmsg("invalid input syntax for BSON"))); |
| 453 | } |
| 454 | |
| 455 | /* since bson strings are palloced - we can simply return the string created. */ |
| 456 | return bson_as_canonical_extended_json(&bson, NULL); |
| 457 | } |
| 458 | |
| 459 | |
| 460 | /* |
no outgoing calls
no test coverage detected