Re: BUG #18589: pg_get_viewdef returns wrong query - Mailing list pgsql-bugs

From Richard Guo
Subject Re: BUG #18589: pg_get_viewdef returns wrong query
Date
Msg-id CAMbWs4_AP5Rrw8bc3N+E_fUVKc3_AWZexyWJRujRFyM-CcPyYg@mail.gmail.com
Whole thread Raw
In response to Re: BUG #18589: pg_get_viewdef returns wrong query  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #18589: pg_get_viewdef returns wrong query
List pgsql-bugs
On Thu, Aug 29, 2024 at 3:03 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I was just about to commit v2 when I realized that it's wrong, because
> what we need to be checking against is the output column name(s) that
> get_target_list() will print, and that's not necessarily tle->resname.
> You can in fact make v2 misbehave with ALTER VIEW RENAME COLUMN, as
> shown by the added test cases in attached v3.

Ah yes, we need to match the column name from the view's tuple
descriptor, which may differ from tle->resname after column RENAME.

+1 to v3.

Thanks
Richard



pgsql-bugs by date:

Previous
From: Francisco J. Ossandón
Date:
Subject: Re: BUG #18594: CASE WHEN ELSE failing to return the expected output when the same colum is used in WHEN and ELSE
Next
From: PG Bug reporting form
Date:
Subject: BUG #18595: Doesn't exist repodata folder in repository