Query the definition of a materialized view in Postgres
Looks like 9.3 and up you can do:

select * from pg_matviews;
select * from pg_matviews where matviewname = 'view_name';


More info found here: https://stackoverflow.com/questions/29297296/postgres-see-query-used-to-create-materialized-view