Hi Olle
Thanks for your message. We have a pending feature request to document the required grants for each dialect:
It's a bit of work. There are weird details like for example in PostgreSQL, you can query quite a lot of things in the pg_catalog without even having any privileges to the objects, whereas some of the information_schema tables are quite useless if you don't have excessive privileges. For example, you cannot see anything in information_schema.table_constraints, unless you have some write privilege (!):
This is required by the SQL standard and implemented "correctly" in PostgreSQL, even if I completely fail to see the logic behind this. So, you might have run into such a case. It's a painful tradeoff between:
1. Being able to rely on backwards compatible information_schema, which might not contain the desired data
2. Rely on the frequently breaking pg_catalog, which contains all the desired data, but in a very low level format
Obviously, we'd also like to offer being able to generate code with the least amount of privileges possible. When the above issue #10820 is implemented, we'll be able to make formal guarantees as we'll be integration testing things with the lowest possible set of privileges rather than working with elevated users right now. Until then, there's no such guarantee, and you need to add more privileges.
Thanks,
Lukas