mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-26 12:19:56 -05:00
### Does this PR have any customer impact? No ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Feature ### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes) Yes ### Are you introducing any new config? If yes, do you have tests with and without them being set? Yes; yes ### ChangeLog (Refer [Template](../oss/CHANGELOG.md)) ### Description Support `collation` with query operator using an internal UDF: ``` bson_query_match(document bson, query bson, collationString text, variableSpec bson) ``` Enable feature with `EnableCollationAndLetForQueryMatch` GUC. Collation on sharded collections with collation-aware shard keys not supported yet. ---- #### AI description (iteration 1) #### PR Classification New feature #### PR Summary This pull request adds collation support for query operators in the engine. - `query_operator.c`: Added logic to handle collation strings in BSON query operators and expanded function to support collation and variable specifications. - `metadata_cache.c`: Introduced a new function to get the OID of `bson_query_match` with collation and let arguments. - `feature_flag_configs.c`: Added a new feature flag to enable collation and let for write commands. - `bson_query_match--0.102.sql` and `bson_query_match--latest.sql`: Added new SQL functions to support collation in BSON queries. - `documents_planner.c`: Updated planner to recognize and handle the new collation and let functionality in queries. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
24 lines
975 B
SQL
24 lines
975 B
SQL
CREATE OR REPLACE FUNCTION __API_CATALOG_SCHEMA__.query_match_support(internal)
|
|
RETURNS internal
|
|
LANGUAGE c
|
|
IMMUTABLE PARALLEL SAFE STRICT
|
|
AS 'MODULE_PATHNAME', $$query_match_support$$;
|
|
|
|
CREATE OR REPLACE FUNCTION __API_CATALOG_SCHEMA__.bson_query_match(__CORE_SCHEMA__.bson, __CORE_SCHEMA__.bson)
|
|
RETURNS bool
|
|
LANGUAGE c
|
|
IMMUTABLE PARALLEL SAFE STRICT
|
|
SUPPORT __API_CATALOG_SCHEMA__.query_match_support
|
|
AS 'MODULE_PATHNAME', $function$bson_query_match$function$;
|
|
|
|
CREATE OR REPLACE FUNCTION __API_CATALOG_SCHEMA__.bson_true_match(__CORE_SCHEMA__.bson)
|
|
RETURNS bool
|
|
LANGUAGE c
|
|
IMMUTABLE PARALLEL SAFE STRICT
|
|
AS 'MODULE_PATHNAME', $function$bson_true_match$function$;
|
|
|
|
CREATE OR REPLACE FUNCTION __API_SCHEMA_INTERNAL_V2__.bson_query_match(document __CORE_SCHEMA__.bson, query __CORE_SCHEMA__.bson, collationString text, variableSpec __CORE_SCHEMA__.bson)
|
|
RETURNS bool
|
|
LANGUAGE c
|
|
IMMUTABLE PARALLEL SAFE
|
|
AS 'MODULE_PATHNAME', $function$bson_query_match$function$; |