Eli Mesika has uploaded a new change for review. Change subject: core: fixing user types cleanup support ......................................................................
core: fixing user types cleanup support Changing implementation code to support PG version < 9.2 Since we support CentOS 6.5 that comes with PG 8.4, the query that gets the user defined types cannot rely on the user_defined_types view that was added only in PG 9.2. This patch changed the underlying PG query to use basic pg tables that exists in PG 8.4 and up. Change-Id: I9a13cbf218bc39f9b5d3f988e10cfadb7121af67 Signed-off-by: Eli Mesika <emes...@redhat.com> --- M packaging/dbscripts/common_sp.sql M packaging/setup/ovirt_engine_setup/database.py 2 files changed, 9 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/70/22170/1 diff --git a/packaging/dbscripts/common_sp.sql b/packaging/dbscripts/common_sp.sql index 41f99dc..b3d5806 100644 --- a/packaging/dbscripts/common_sp.sql +++ b/packaging/dbscripts/common_sp.sql @@ -285,10 +285,13 @@ Create or replace FUNCTION generate_drop_all_user_types_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN -RETURN QUERY select 'DROP TYPE if exists ' || user_defined_type_name || ' CASCADE;' from information_schema.user_defined_types where user_defined_type_schema = 'public' order by user_defined_type_name; +RETURN QUERY SELECT 'DROP TYPE if exists ' || c.relname::information_schema.sql_identifier || ' CASCADE;' + FROM pg_namespace n, pg_class c, pg_type t + WHERE n.oid = c.relnamespace and t.typrelid = c.oid and c.relkind = 'c'::"char" and + n.nspname = 'public' + ORDER BY c.relname::information_schema.sql_identifier; END; $procedure$ LANGUAGE plpgsql; - Create or replace FUNCTION fn_get_column_size( v_table varchar(64), v_column varchar(64)) returns integer STABLE AS $procedure$ diff --git a/packaging/setup/ovirt_engine_setup/database.py b/packaging/setup/ovirt_engine_setup/database.py index 156980a..9be8c87 100644 --- a/packaging/setup/ovirt_engine_setup/database.py +++ b/packaging/setup/ovirt_engine_setup/database.py @@ -362,12 +362,13 @@ union select 'drop type if exists ' || - user_defined_type_name || ' ' || + c.relname::information_schema.sql_identifier || ' ' || 'cascade;' from - information_schema.user_defined_types + pg_namespace n, pg_class c, pg_type t where - user_defined_type_schema = 'public'; + n.oid = c.relnamespace and t.typrelid = c.oid and + c.relkind = 'c'::"char" and n.nspname = 'public'; end; $procedure$ language plpgsql; """, -- To view, visit http://gerrit.ovirt.org/22170 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9a13cbf218bc39f9b5d3f988e10cfadb7121af67 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <emes...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches