mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-07 03:22:46 -05:00
### Does this PR have any customer impact? Yes ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Bugfix ### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes) No ### Are you introducing any new config? If yes, do you have tests with and without them being set? No ### ChangeLog (Refer [Template](../oss/CHANGELOG.md)) ### Description [DocumentDB issus 178](https://github.com/microsoft/documentdb/issues/178) When the document size exceeds 2000, the tuple is toasted. We need to detoast the datum before converting it to pgbson. ---- #### AI description (iteration 1) #### PR Classification Bug fix addressing improper detoasting of pgbson values. #### PR Summary This pull request replaces direct pointer extraction and SPI_datumTransfer calls with dedicated DatumGetPgBson macros to ensure both toasted and non-toasted bson documents are correctly handled. It also enhances test coverage for find-and-modify operations on large documents. - `commands_find_and_modify.out` and SQL test files: Added new queries for deleting large (toasted) and non-toasted documents. - `retryable_writes.c`, `delete.c`, metadata, index, and query operator files: Replaced manual SPI_datumTransfer and DatumGetPointer calls with DatumGetPgBson (and DatumGetPgBson_MAYBE_NULL) to properly detoast and copy pgbson objects. - `pgbson.h` and `bson_io.c`: Introduced and integrated new macros to streamline detoasting of pgbson data. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->