To trigger a seed script that creates materialized views. Before the update it would return true is the mat view existed. After the update it returns false. Testing on normal tables works fine, it seems to just be issue with materialized view.
The behavior of TableExists<T> for PostgreSQL has not changed which checks for relkind = ‘r’ (i.e. ordinary table) where as Material views should report relkind = ‘m’ so it should not report true for materialized views.
The only expected behavior is what’s returned by the relkind = ‘r’ (i.e ordinary table) metadata query:
For materialized views you’d instead search for relkind = 'm' instead, in most cases (when not using a schema) this should suffice:
var sql = "SELECT COUNT(*) FROM pg_class WHERE lower(relname) = {0} AND relkind = 'm'".SqlFmt(tableName.ToLower());
var exists = dbCmd.ExecLongScalar(sql) > 0;