Files
documentdb/pg_documentdb
Lusen Dong ed860f8b6d Merged PR 1525182: [OSS] helio_api.validate different error code with mongo
### Does this PR have any customer impact?
No
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Expects MongoDB error code 73 with collection name has invalid type object message. Not MongoDB error code 26 (M0008).

postgres=# SELECT * FROM helio_api.validate('test','{"validate":{}}');
ERROR:  BSON field 'validate' is the wrong type 'object', expected type 'string'
postgres=# \errverbose
ERROR:  M0004: BSON field 'validate' is the wrong type 'object', expected type 'string'
LOCATION:  ThrowTopLevelTypeMismatchError, parse_error.h:24

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix

#### PR Summary
This pull request addresses an issue with the `helio_api.validate` function returning an incorrect error code.
- Modified `oss/pg_helio_api/src/commands/validate.c` to check if the `validate` field is of type `BSON_TYPE_DOCUMENT` and return the appropriate error message and code.

Related work items: #3658791
2025-01-15 07:48:40 +00:00
..