mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-26 04:09:50 -05:00
### Does this PR have any customer impact? No ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Refactoring ### 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? No ### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md)) ### Description Porting udfs into documentdb ---- #### AI description (iteration 1) #### PR Classification Code cleanup and feature enhancement. #### PR Summary This pull request continues the porting of UDFs into DocumentDB, updating and including various SQL files for better functionality and organization. - Updated `documentdb--0.24-0.sql` to include new UDFs and operators, replacing old function references. - Added new UDFs for query, projection, geospatial, aggregation, metadata, schema management, index management, CRUD commands, user management, schema validation, telemetry, TTL, vector search, extension version, diagnostic, and RBAC metadata. - Removed outdated function definitions and replaced them with updated SQL includes.
40 lines
2.0 KiB
SQL
40 lines
2.0 KiB
SQL
|
|
|
|
-- dummy function that accepts the query planner phase, and exists only to handle the support function handling
|
|
-- to push down to the index.
|
|
CREATE OR REPLACE FUNCTION __API_SCHEMA_INTERNAL_V2__.bson_dollar_text(__CORE_SCHEMA__.bson, __CORE_SCHEMA__.bson)
|
|
RETURNS bool
|
|
LANGUAGE c
|
|
SUPPORT __API_CATALOG_SCHEMA__.dollar_support
|
|
COST 10000000000 -- really dissuade the planner from using this and force the index.
|
|
IMMUTABLE PARALLEL SAFE STRICT
|
|
AS 'MODULE_PATHNAME', $function$bson_dollar_text$function$;
|
|
|
|
-- dummy function that exists to support the index operator (below). Needs to be separate from above due to the
|
|
-- 'tsquery' being an input. We can't generate the tsquery during the planning phase as we must use the default_language
|
|
-- in the index definition as STOP words defaults. Consequently the planner generates the function above, then the support
|
|
-- generates the operator below.
|
|
CREATE OR REPLACE FUNCTION __API_SCHEMA_INTERNAL_V2__.bson_text_tsquery(__CORE_SCHEMA__.bson, tsquery)
|
|
RETURNS bool
|
|
LANGUAGE c
|
|
IMMUTABLE PARALLEL SAFE STRICT
|
|
AS 'MODULE_PATHNAME', $function$bson_dollar_text$function$;
|
|
|
|
-- This is a function that tracks the input tsquery, and the index options associated with it so that $meta queries
|
|
-- can be made to work - injected during the plan phase.
|
|
-- Also used to do a runtime $text scan if necessary.
|
|
CREATE OR REPLACE FUNCTION __API_SCHEMA_INTERNAL_V2__.bson_text_meta_qual(__CORE_SCHEMA__.bson, tsquery, bytea, bool)
|
|
RETURNS bool
|
|
LANGUAGE c
|
|
IMMUTABLE PARALLEL SAFE STRICT
|
|
AS 'MODULE_PATHNAME', $function$bson_dollar_text_meta_qual$function$;
|
|
|
|
|
|
DROP FUNCTION IF EXISTS __API_SCHEMA_INTERNAL_V2__.bson_query_to_tsquery;
|
|
|
|
-- This is a diagnostic query used to test translation of $text search clauses to TSQuery in Postgres.
|
|
CREATE OR REPLACE FUNCTION __API_SCHEMA_INTERNAL_V2__.bson_query_to_tsquery(query __CORE_SCHEMA__.bson, textSearch text default NULL)
|
|
RETURNS tsquery
|
|
LANGUAGE c
|
|
IMMUTABLE PARALLEL SAFE
|
|
AS 'MODULE_PATHNAME', $function$command_bson_query_to_tsquery$function$; |