mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-08 20:05:29 -05:00
### Does this PR have any customer impact? No ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Comments ### 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 All the previous version SQL changes should be merged into this PR so that we can update the hashes in this PR ---- #### AI description (iteration 1) #### PR Classification This PR is a documentation update that cleans up inline SQL comments to align with the latest contributing guidelines. #### PR Summary The changes refine the SQL file comments for geospatial operator classes and functions by removing outdated references to Mongo indexing and validations. - `oss/pg_documentdb/sql/operators/bson_gist_geospatial_op_classes--0.16-0.sql`: Updated comments by replacing "mongo 2d index options" and "mongo 2dsphjere index options" with simplified descriptions. - `oss/pg_documentdb/sql/udfs/geospatial/bson_gist_extensibility_functions--0.16-0.sql` and `oss/pg_documentdb/sql/udfs/geospatial/bson_gist_extensibility_functions--latest.sql`: Revised function comments to remove "mongo db validations" for a more general description of geometry validations. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> Related work items: #4354111
29 lines
1.3 KiB
PL/PgSQL
29 lines
1.3 KiB
PL/PgSQL
/*
|
|
* This function returns rows from an empty table that mimics a documentdb collection data table
|
|
* w.r.t. the data types of the columns.
|
|
*
|
|
* We need this to enable scenarios that require us to return an the equvalent of a
|
|
empty collection when the collection does not exists.
|
|
*
|
|
* The planner hook for __API_SCHEMA__.collection('db', 'collName') will call this function
|
|
* when the desired collection is not found.
|
|
*
|
|
* We could have made a similar change in the __API_SCHEMA__.collection() function itself,
|
|
* but having a different function provides better debuggability, i.e., the EXPLAIN will
|
|
* show "Function Scan on empty_data_table collection" instead of "Function Scan on collection".
|
|
* The latter could happen for other reasons.
|
|
*/
|
|
DROP FUNCTION IF EXISTS __API_SCHEMA_V2__.empty_data_table;
|
|
CREATE OR REPLACE FUNCTION __API_SCHEMA_INTERNAL_V2__.empty_data_table(
|
|
OUT shard_key_value bigint,
|
|
OUT object_id __CORE_SCHEMA_V2__.bson,
|
|
OUT document __CORE_SCHEMA_V2__.bson,
|
|
OUT creation_time timestamptz)
|
|
RETURNS SETOF record
|
|
AS $fn$
|
|
BEGIN
|
|
RETURN QUERY EXECUTE format($$SELECT 0::bigint, null::__CORE_SCHEMA_V2__.bson, null::__CORE_SCHEMA_V2__.bson, null::timestamptz WHERE false$$);
|
|
END;
|
|
$fn$ LANGUAGE plpgsql;
|
|
COMMENT ON FUNCTION __API_SCHEMA_INTERNAL_V2__.empty_data_table()
|
|
IS 'mimics a data collection with 0 rows'; |