]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
DRYD-1748: Add deurn function to database (#464)
authorAnthony Bucci <anthony@bucci.onl>
Fri, 16 May 2025 22:17:30 +0000 (22:17 +0000)
committerGitHub <noreply@github.com>
Fri, 16 May 2025 22:17:30 +0000 (16:17 -0600)
* DRYD-1748: added SQL script to define deurn function
* DRYD-1748: modified tenant bindings to run deurn_function.sql

---------

Co-authored-by: Anthony Bucci <abucci@bucci.onl>
services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml
services/common/src/main/resources/db/postgresql/deurn_function.sql [new file with mode: 0644]

index 762f8d6e4c43d973852338a071827ca8c2c398d3..ad0e626e8ef72062730d425d70fce7c661e45348 100644 (file)
                                                <service:key>sqlScriptName</service:key>
                                                <service:value>unaccent_text_search_configuration.sql</service:value>
                                        </service:property>
+                                       <service:property>
+                                               <service:key>sqlScriptName</service:key>
+                                               <service:value>deurn_function.sql</service:value>
+                                       </service:property>
                                </service:params>
                        </service:initHandler>
                </tenant:serviceBindings>
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 (file)
index 0000000..155ce99
--- /dev/null
@@ -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;