Index: openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.7.0d2-5.7.0d3.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.7.0d2-5.7.0d3.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.7.0d2-5.7.0d3.sql 30 Jan 2011 01:36:33 -0000 1.1 +++ openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.7.0d2-5.7.0d3.sql 20 Feb 2011 00:34:00 -0000 1.2 @@ -28,6 +28,10 @@ end if; end if; + select count(*) = 0 into v_temp_p + from pg_class + where relname = lower(create_type__table_name); + PERFORM acs_object_type__create_type ( create_type__content_type, create_type__pretty_name, @@ -39,7 +43,7 @@ ''f'', null, create_type__name_method, - ''t'', + v_temp_p, ''f'' ); @@ -75,6 +79,12 @@ raise EXCEPTION ''-20000: Content type % does not exist in content_type.create_attribute'', create_attribute__content_type; end if; + select count(*) > 0 into v_column_exists + from pg_class c, pg_attribute a + where c.relname::varchar = v_table_name + and c.oid = a.attrelid + and a.attname = lower(create_attribute__attribute_name); + v_attr_id := acs_attribute__create_attribute ( create_attribute__content_type, create_attribute__attribute_name, @@ -89,7 +99,7 @@ create_attribute__sort_order, ''type_specific'', ''f'', - ''t'', + not v_column_exists, null, null, null,