Re: Unqualified relations in views - Mailing list pgsql-general

From Pete O'Such
Subject Re: Unqualified relations in views
Date
Msg-id CAEdngj-aP_KgDHqKMeasSSxgZ272GbKkh4-_-8LiWNeMrEmDDg@mail.gmail.com
Whole thread Raw
In response to Re: Unqualified relations in views  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-general
> 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

pgsql-general by date:

Previous
From: Anthony Apollis
Date:
Subject: Re: Making Sure Primary and Secondary Keys Alligns
Next
From: Sándor Daku
Date:
Subject: Re: Making Sure Primary and Secondary Keys Alligns