schemacrawler / SchemaCrawler

Free database schema discovery and comprehension tool
http://www.schemacrawler.com/
Other
1.62k stars 200 forks source link

Postgresql 10.5 and 11.1 - no materialized views #234

Closed rotten closed 5 years ago

rotten commented 5 years ago

Issue (or feature request?)

Even at maximum info level, schemacrawler does not discover materialized views in postgresql 10.5 or 11.1.

(It doesn't discover foreign tables either, but I wasn't really expecting it to.)

Materialized Views are an essential and widely used part of modern PostgreSQL database design. Not including them leaves a major hole in the full picture of the data models.

Environment

SchemaCrawler 15.02.02 Oracle Corporation OpenJDK 64-Bit Server VM 10.0.2+13-Ubuntu-1ubuntu0.18.04.4 Linux 4.15.0-39-generic using the jdbc driver bundled with it: schemacrawler-postgresql-15.02.02.jar

sualeh commented 5 years ago

I agree. This would be an enhancement. I will take a look.

adriens commented 5 years ago

Maybe that jdbc driver does not implement sending this datas..strange as materialized views are usually considered as tables

We can list materialized views from select * from pg_matviews (at least on PG 9.6)

2018-12-01 09_11_47-pgadmin 4

rotten commented 5 years ago

You can also get them by looking at the relkind column of pg_class. If it is an 'm' it is a materialized view.
https://www.postgresql.org/docs/11/catalog-pg-class.html

sualeh commented 5 years ago

@rotten - I did some research, and found that SchemaCrawler will support PostgreSQL materialized views out of the box. Please try using the following command-line argument, and let me know if it works for you:

-tabletypes=TABLE,VIEW,MATERIALIZED VIEW

rotten commented 5 years ago

That works! Awesome, thanks!

sualeh commented 5 years ago

Great!