Alon Bar-Lev has uploaded a new change for review.

Change subject: packaging: setup: have our own 
generate_drop_all_functions_syntax
......................................................................

packaging: setup: have our own generate_drop_all_functions_syntax

there may be many cases in which after failure we will not have
generate_drop_all_functions_syntax function, thus will be unable to drop
functions.

so provide our own and make sure we fail if fails.

Change-Id: I2a64f3a38558b88eb3904dde034617b0deca54c9
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M packaging/setup/ovirt_engine_setup/database.py
1 file changed, 33 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/99/16799/1

diff --git a/packaging/setup/ovirt_engine_setup/database.py 
b/packaging/setup/ovirt_engine_setup/database.py
index 082c2cc..262f82a 100644
--- a/packaging/setup/ovirt_engine_setup/database.py
+++ b/packaging/setup/ovirt_engine_setup/database.py
@@ -332,6 +332,38 @@
             environment=self.environment,
         )
         try:
+            statement.execute(
+                statement="""
+                    create or replace
+                    function
+                        generate_drop_all_functions_syntax()
+                        returns setof text
+                    AS $procedure$ begin
+                        return query
+                            select
+                                'drop function if exists ' ||
+                                ns.nspname ||
+                                '.' ||
+                                proname ||
+                                '(' ||
+                                    oidvectortypes(proargtypes) ||
+                                ') cascade;'
+                            from
+                                pg_proc inner join pg_namespace ns on (
+                                    pg_proc.pronamespace=ns.oid
+                                )
+                            where
+                                ns.nspname = 'public' and
+                                proname not ilike 'uuid%%'
+                            order by proname;
+                    end; $procedure$
+                    language plpgsql;
+                """,
+                args=dict(),
+                ownConnection=True,
+                transaction=False,
+            )
+
             spdrops = statement.execute(
                 statement="""
                     select generate_drop_all_functions_syntax as drop
@@ -351,6 +383,7 @@
                 'generate_drop_all_functions_syntax failed',
                 exc_info=True,
             )
+            raise
         tables = statement.execute(
             statement="""
                 select table_name


-- 
To view, visit http://gerrit.ovirt.org/16799
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2a64f3a38558b88eb3904dde034617b0deca54c9
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to