Re: Bug: pg_get_viewdef() fails on GRAPH_TABLE views with lateral column references

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-24T07:18:12Z
Lists: pgsql-hackers
On 21.04.26 10:02, SATYANARAYANA NARLAPURAM wrote:
>     The code doesn't explain why it adds the dummy context but it seemed
>     intentional. But it's not used at other places like deparsing WHERE
>     clause in element patterns or that in the graph_table itself. Since a
>     lateral reference is allowed in COLUMNS clause as well, it doesn't
>     make sense not to pass a context with lateral namespaces. Also there
>     is no comment explaining the dummy context. So your fix looks good to
>     me. I adjusted the surrounding code a bit.
> 
>     I adjusted an existing view for the testing instead of adding a new
>     one with all the additional objects. Since that view definition was
>     getting more complex, I formatted the DDL to be more readable.
> 
>     I also think that we should use prettyFlags to deparse all GRAPH_TABLE
>     components in a human readable form. But that's out of the scope for
>     this patch.
> 
>     PFA updated patch.
> 
> Thank you for updating the patch. It applies cleanly and the related 
> tests are passing.

committed




Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. pg_get_viewdef() and lateral references in COLUMNS of GRAPH_TABLE