Re: BUG #18589: pg_get_viewdef returns wrong query

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: tlhquynh(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18589: pg_get_viewdef returns wrong query
Date: 2024-08-29 07:19:43
Message-ID: CAMbWs4_AP5Rrw8bc3N+E_fUVKc3_AWZexyWJRujRFyM-CcPyYg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Aug 29, 2024 at 3:03 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-bugs by date

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