Index: openacs-4/packages/ecommerce/sql/postgresql/ecommerce-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/sql/postgresql/ecommerce-create.sql,v
diff -u -r1.19 -r1.20
--- openacs-4/packages/ecommerce/sql/postgresql/ecommerce-create.sql	23 Jan 2008 19:05:55 -0000	1.19
+++ openacs-4/packages/ecommerce/sql/postgresql/ecommerce-create.sql	9 Aug 2008 19:24:21 -0000	1.20
@@ -33,6 +33,23 @@
 create sequence ec_template_id_seq start 2;
 create view ec_template_id_sequence as select nextval('ec_template_id_seq') as nextval;
 
+-- Helper stuff (ben@adida.net)
+-- gilbertw - I pulled this from OpenACS 3.2.5
+-- there are a few calls to the Oracle least function
+create function least(numeric,numeric)
+returns numeric
+as '
+DECLARE
+        first alias for $1;
+        second alias for $2;
+BEGIN
+        if first < second
+        then return first;
+        else return second;
+        end if;
+END;
+' language 'plpgsql';
+
 -- gilbertw
 -- timespan_days taken from OpenACS 3.2.5
 -- can't cast numeric to varchar/text so I made the input varchar
@@ -3310,3 +3327,4 @@
 \i ec-product-package-create.sql
 \i ecommerce-defaults.sql
 \i ec-product-sc-create.sql
+\i ecds-create.sql
