[FIX] core: also consider materialized views as existing
At the end of registry loading, a check is made on every model to
verify its table exists in the database. Materialized views weren't
considered during this check.
Note that we can't use `information_schema` views in this case because
it does include materialized views on purpose [1].
Forward-port of 4ca6945256
[1] http://www.postgresql-archive.org/Materialized-views-don-t-show-up-in-information-schema-tp5822643p5822644.html
This commit is contained in:
+1
-1
@@ -23,7 +23,7 @@ _CONFDELTYPES = {
|
||||
|
||||
def table_exists(cr, tablename):
|
||||
""" Return whether the given table exists. """
|
||||
query = "SELECT 1 FROM information_schema.tables WHERE table_name=%s"
|
||||
query = "SELECT 1 FROM pg_class WHERE relkind IN ('r', 'v', 'm') AND relname=%s"
|
||||
cr.execute(query, (tablename,))
|
||||
return cr.rowcount
|
||||
|
||||
|
||||
Reference in New Issue
Block a user