Index: openacs-4/packages/ams/sql/postgresql/ams-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/sql/postgresql/ams-package-create.sql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/ams/sql/postgresql/ams-package-create.sql 9 Sep 2005 14:06:12 -0000 1.7 +++ openacs-4/packages/ams/sql/postgresql/ams-package-create.sql 30 Jan 2006 22:22:58 -0000 1.8 @@ -200,6 +200,21 @@ end;' language 'plpgsql' stable strict; + +create or replace function ams_attribute_value__value_by_object_id (integer,integer) +returns text as ' +declare + p_attribute_id alias for $1; + p_object_id alias for $2; + v_value text; +begin + val := ams_attribute_value__value(p_attribute_id,( select aav.value_id from ams_attribute_values aav where aav.object_id = p_object_id and aav.attribute_id = p_attribute_id)); + + return v_value; +end;' language 'plpgsql' stable strict; + + + ------ Options -------------------------------------------------------------------- @@ -595,7 +610,8 @@ and postal_code = p_postal_code and country_code = p_country_code and additional_text is NULL - and postal_type is NULL; + and postal_type is NULL + limit 1; else @@ -607,7 +623,8 @@ and postal_code = p_postal_code and country_code = p_country_code and additional_text = p_additional_text - and postal_type = p_postal_type; + and postal_type = p_postal_type + limit 1; end if;