Re: Unqualified relations in views

From: "Pete O'Such" <posuch(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Unqualified relations in views
Date: 2023-09-13 17:41:34
Message-ID: CAEdngj-aP_KgDHqKMeasSSxgZ272GbKkh4-_-8LiWNeMrEmDDg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sándor Daku 2023-09-13 17:49:29 Re: Making Sure Primary and Secondary Keys Alligns
Previous Message Anthony Apollis 2023-09-13 09:06:56 Re: Making Sure Primary and Secondary Keys Alligns