Re: BUG #19767: pg_get_viewdef prints ORDER BY (- '3'::int4) as (- 3), which reparses as column position -3

From: solai v <solai(dot)cdac(at)gmail(dot)com>
To: Nitin Motiani <nitinmotiani(at)google(dot)com>
Cc: assam258(at)gmail(dot)com, alpkeles99(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19767: pg_get_viewdef prints ORDER BY (- '3'::int4) as (- 3), which reparses as column position -3
Date: 2026-10-27 09:30:19
Message-ID: CAF0whucYhma1rz0OUrbDo1haAiEXTzrh-o8CM=jPNr2J58swJw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,
I tested the v2 patch and I would like to share my observations.
Before applying the patch, pg_get_viewdef() generated output such as
ORDER BY (- 3), which could be misinterpreted as a column position
when the view definition was parsed again.
After applying the patch, the output included the explicit type cast,
for example, ORDER BY (- 3::integer). I also verified that the
recreated views worked correctly.
The regression tests covering ORDER BY, GROUP BY, and reloading the
generated view definitions passed, and all regression tests passed in
my testing environment.
Based on these results, the patch appears to address the reported
issue. Thank you for your work on this fix.

Regards,
Solai

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message Tender Wang 2026-10-27 09:28:22 Re: BUG #19800: Wrong results: self-join elimination drops an ORDER BY sort key with GROUPING SETS / CUBE / ROLLUP