From: Anthony Bucci Date: Fri, 16 May 2025 22:17:30 +0000 (+0000) Subject: DRYD-1748: Add deurn function to database (#464) X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=5e7b8ec026ae3fdcd4cb35d413c7fa9a024e4e6a;p=tmp%2Fjakarta-migration.git DRYD-1748: Add deurn function to database (#464) * DRYD-1748: added SQL script to define deurn function * DRYD-1748: modified tenant bindings to run deurn_function.sql --------- Co-authored-by: Anthony Bucci --- diff --git a/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml b/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml index 762f8d6e4..ad0e626e8 100644 --- a/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml +++ b/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml @@ -75,6 +75,10 @@ sqlScriptName unaccent_text_search_configuration.sql + + sqlScriptName + deurn_function.sql + diff --git a/services/common/src/main/resources/db/postgresql/deurn_function.sql b/services/common/src/main/resources/db/postgresql/deurn_function.sql new file mode 100644 index 000000000..155ce99fa --- /dev/null +++ b/services/common/src/main/resources/db/postgresql/deurn_function.sql @@ -0,0 +1,3 @@ +-- Convert a URN (often refname) (DRYD-1748: Add deurn function to database) +CREATE OR REPLACE FUNCTION deurn(urnstr VARCHAR) RETURNS VARCHAR +AS $BODY$ BEGIN RETURN ((regexp_match(urnstr, '''([^''\\]*(\\.[^''\\]*)*)'''))[1]); END $BODY$ LANGUAGE plpgsql IMMUTABLE;