Files
documentdb/pg_documentdb/sql/udfs/schema_mgmt/drop_database--latest.sql
T
Zinan Ren d4d61b7278 Merged PR 1543270: [OSS] Move udf files from pg_helio_api -> pg_documentdb
### 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

Move udf files from pg_helio_api -> pg_documentdb

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup

#### PR Summary
This pull request moves User Defined Function (UDF) files from the `pg_helio_api` directory to the `pg_documentdb` directory.
- Updated `pgmongo/sql/pgmongo--1.23-0--1.24-0.sql` to include UDFs from `pg_documentdb` instead of `pg_helio_api`.
- Modified `oss/pg_helio_api/sql/pg_helio_api--1.15-0--1.16-0.sql` to reference UDFs from `pg_documentdb`.
- Adjusted `oss/pg_helio_api/sql/pg_helio_api--1.10-0.sql` to include UDFs from `pg_documentdb`.
- Updated `scripts/validate_helio_extension_state.sh` to add validation exceptions for the moved UDF files.
- Changed `pgmongo/sql/pgmongo--1.21-0--1.22-0.sql` to reference UDFs from `pg_documentdb`.
2025-01-15 07:48:40 +00:00

27 lines
780 B
PL/PgSQL

/* db.dropDatabase(writeConcern) */
CREATE OR REPLACE FUNCTION helio_api.drop_database(
p_database_name text,
p_write_concern helio_core.bson default null)
RETURNS void
SET search_path TO helio_core, pg_catalog
AS $fn$
DECLARE
v_collection record;
BEGIN
/* TODO: lock on database to prevent concurrent table addition */
FOR
v_collection
IN
SELECT
database_name, collection_name
FROM
__API_CATALOG_SCHEMA__.collections
WHERE
database_name = p_database_name
LOOP
PERFORM helio_api.drop_collection(v_collection.database_name, v_collection.collection_name);
END LOOP;
END;
$fn$ LANGUAGE plpgsql;
COMMENT ON FUNCTION helio_api.drop_database(text,helio_core.bson)
IS 'drop a HelioAPI database';