summaryrefslogtreecommitdiff
path: root/openerp/tools/sql.py
diff options
context:
space:
mode:
Diffstat (limited to 'openerp/tools/sql.py')
-rw-r--r--openerp/tools/sql.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/openerp/tools/sql.py b/openerp/tools/sql.py
index 445eebb0bb8..3397d1ecbd3 100644
--- a/openerp/tools/sql.py
+++ b/openerp/tools/sql.py
@@ -20,9 +20,7 @@
##############################################################################
def drop_view_if_exists(cr, viewname):
- cr.execute("select count(1) from pg_class where relkind=%s and relname=%s", ('v', viewname,))
- if cr.fetchone()[0]:
- cr.execute("DROP view %s" % (viewname,))
- cr.commit()
+ cr.execute("DROP view IF EXISTS %s CASCADE" % (viewname,))
+ cr.commit()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: