From 6d907fb132386ac1b225840e0e8e4d5cc9e597a3 Mon Sep 17 00:00:00 2001 From: miker Date: Fri, 16 Oct 2009 00:25:10 +0000 Subject: [PATCH] protect 0-param normalizers from null params value git-svn-id: svn://svn.open-ils.org/ILS/trunk@14464 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/002.schema.config.sql | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index dce7d5fa97..2683cc6ed3 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -605,13 +605,21 @@ BEGIN 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; -- 2.11.0