-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Labels
Description
Should Materialized Views be listed by dbListTables()
?
I'd argue they should since they are objects that share characteristics of both Tables and Views, both of which are returned by dbListTables()
, see #27 & #29.
See this thread on the psql-hackers list for a discussion on why they are not in the INFORMATION_SCHEMA.tables
(which includes Views). Tl;dr: "They are not defined by the SQL standard." I see this as a relatively minor point w.r.t. RPostgres, though.
As it stands there is no helper function like dbListTables()
to list Materialized Views in RPostgres.
The following query shows all Tables, Views and Materialized Views (I have not looked into temporary tables, yet):
SELECT tablename AS name FROM pg_tables WHERE schemaname = ANY (current_schemas(false))
UNION
SELECT viewname AS name FROM pg_views WHERE schemaname = ANY (current_schemas(false))
UNION
SELECT matviewname as name FROM pg_matviews WHERE schemaname = ANY (current_schemas(false))
ORDER BY name;