Teach asset.merge_record_assets about STRING_AGG()
authorDan Scott <dscott@laurentian.ca>
Thu, 13 Oct 2011 22:56:26 +0000 (18:56 -0400)
committerDan Scott <dscott@laurentian.ca>
Fri, 11 Nov 2011 20:38:04 +0000 (15:38 -0500)
Now that asset.merge_record_assets() is working, cut over to
STRING_AGG() so it can iterate over those unnecessary nodes faster :)

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/sql/Pg/999.functions.global.sql

index da05afe..53db65b 100644 (file)
@@ -996,17 +996,15 @@ BEGIN
                        ' tag="856"' ||
                        ' ind1="' || FIRST(ind1) || '"'  ||
                        ' ind2="' || FIRST(ind2) || '">' ||
-                        array_to_string(
-                            ARRAY_AGG(
-                                '<subfield code="' || subfield || '">' ||
+                        STRING_AGG(
+                            '<subfield code="' || subfield || '">' ||
+                            regexp_replace(
                                 regexp_replace(
-                                    regexp_replace(
-                                        regexp_replace(data,'&','&amp;','g'),
-                                        '>', '&gt;', 'g'
-                                    ),
-                                    '<', '&lt;', 'g'
-                                ) || '</subfield>'
-                            ), ''
+                                    regexp_replace(data,'&','&amp;','g'),
+                                    '>', '&gt;', 'g'
+                                ),
+                                '<', '&lt;', 'g'
+                            ) || '</subfield>', ''
                         ) || '</datafield>' INTO uri_datafield
               FROM  oils_xpath_table(
                         'id',