[open-ils-commits] r14463 - trunk/Open-ILS/src/sql/Pg/upgrade (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Oct 15 20:20:17 EDT 2009
Author: miker
Date: 2009-10-15 20:20:16 -0400 (Thu, 15 Oct 2009)
New Revision: 14463
Modified:
trunk/Open-ILS/src/sql/Pg/upgrade/0034.schema.in-db-indexing-normalization.sql
Log:
protect 0-param normalizers from null params value
Modified: trunk/Open-ILS/src/sql/Pg/upgrade/0034.schema.in-db-indexing-normalization.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0034.schema.in-db-indexing-normalization.sql 2009-10-15 22:21:54 UTC (rev 14462)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0034.schema.in-db-indexing-normalization.sql 2009-10-16 00:20:16 UTC (rev 14463)
@@ -12,13 +12,20 @@
IF TG_TABLE_NAME::TEXT ~ 'field_entry$' THEN
FOR normalizer IN
SELECT n.func AS func,
+ n.param_count AS param_count,
m.params AS params
FROM config.index_normalizer n
JOIN config.metabib_field_index_norm_map m ON (m.norm = n.id)
WHERE field = NEW.field
ORDER BY m.pos
LOOP
- EXECUTE 'SELECT ' || normalizer.func || '(' || quote_literal( value ) || ',' || BTRIM(normalizer.params,'[]') || ')' INTO value;
+ EXECUTE 'SELECT ' || normalizer.func || '(' ||
+ quote_literal( value ) ||
+ CASE
+ WHEN normalizer.param_count > 0 THEN ',' || BTRIM(normalizer.params,'[]')
+ ELSE ''
+ END ||
+ ')' INTO value;
END LOOP;
END IF;
More information about the open-ils-commits
mailing list