> PostgreSQL resolves tables and other objects according to the setting of
> "search_path" at CREATE VIEW time. The query itself is stored in parsed form.
>
> pg_get_viewdef() deparses the query and only prepends a schema name if the
> schema is not on the "search_path". So the solution is to set "search_path"
> empty:
>
> SET search_path = '';
>
> SELECT pg_get_viewdef('myschema.myview');
Thank you! That is the perfect answer to my question!
Is Postgres hiding the ball a bit here? Is there a reason that obscuring the
known and static schema is better than showing it? In my case (tracking down
execution differences between local and FDW view use) this has occupied a lot of
time.
Thanks again,
Pete O'Such