Files
documentdb/pg_helio_api/sql/udfs/query/bson_dollar_evaluation--latest.sql
T
Vinod Sridharan 65a0cf4a46 Merged PR 1399519: Let support: Part 1: Add support for let in find/aggregate
### 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

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Add support for `let` in `find` and `aggregate`
- For find ensure that let can be supported both in projection and query.
- For aggregate, so far this is only supported in `$match`.

In subsequent PRs other stages will be reviewed and modified.

Note that this is a precursor to $lookup with let since Lookup's inner pipeline can reference any of those stages that can use `let`

Since this is a partial feature this is guarded with a feature flag.
2024-07-11 17:56:53 +03:00

34 lines
1.2 KiB
SQL

CREATE OR REPLACE FUNCTION __API_CATALOG_SCHEMA__.bson_dollar_regex(__CORE_SCHEMA__.bson, __CORE_SCHEMA__.bson)
RETURNS bool
LANGUAGE c
IMMUTABLE PARALLEL SAFE STRICT
SUPPORT __API_CATALOG_SCHEMA__.dollar_support
AS 'MODULE_PATHNAME', $function$bson_dollar_regex$function$;
CREATE OR REPLACE FUNCTION __API_CATALOG_SCHEMA__.bson_dollar_expr(__CORE_SCHEMA__.bson, __CORE_SCHEMA__.bson)
RETURNS bool
LANGUAGE c
IMMUTABLE PARALLEL SAFE STRICT
AS 'MODULE_PATHNAME', $function$bson_dollar_expr$function$;
CREATE OR REPLACE FUNCTION helio_api_internal.bson_dollar_expr(helio_core.bson, helio_core.bson, helio_core.bson)
RETURNS bool
LANGUAGE c
IMMUTABLE PARALLEL SAFE STRICT
AS 'MODULE_PATHNAME', $function$bson_dollar_expr$function$;
CREATE OR REPLACE FUNCTION __API_CATALOG_SCHEMA__.bson_dollar_json_schema(__CORE_SCHEMA__.bson, __CORE_SCHEMA__.bson)
RETURNS bool
LANGUAGE c
COST 100
IMMUTABLE PARALLEL SAFE STRICT
AS 'MODULE_PATHNAME', $function$bson_dollar_json_schema$function$;
CREATE OR REPLACE FUNCTION __API_CATALOG_SCHEMA__.bson_dollar_mod(__CORE_SCHEMA__.bson, __CORE_SCHEMA__.bson)
RETURNS bool
LANGUAGE c
IMMUTABLE PARALLEL SAFE STRICT
SUPPORT __API_CATALOG_SCHEMA__.dollar_support
AS 'MODULE_PATHNAME', $function$bson_dollar_mod$function$;