| From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Swirl Smog Dowry <swirl-smog-dowry(at)duck(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: pg_get_viewdef() produces non-round-trippable SQL for views with USING join on mismatched integer types |
| Date: | 2026-02-27 08:13:52 |
| Message-ID: | CAMbWs49AUBVtMG=BXwfB5xdg1Zd9dwJg42C1hLayYtO2Kmxqpw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
On Fri, Feb 27, 2026 at 12:23 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> On Fri, Feb 27, 2026 at 3:27 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > The problem is obvious after looking at parseCheckAggregates: the
> > RTE_GROUP RTE is manufactured using the groupClauses list after we
> > have flattened that, which we are only doing for comparison purposes;
> > it shouldn't affect what goes into the parse tree. I experimented
> > with just changing the order of operations, and that seems to fix it.
> Right. We should keep the unmodified GROUP BY expressions in the
> parse tree, and then rely on the planner to flatten the join alias
> vars within them.
>
> +1 to the fix.
I am on the fence about whether this fix is safe to back-patch to v18.
I cautiously think it is safe, as it does not change the parsetree's
external representation and does not require an initdb.
However, this fix will only apply to newly created views. Users who
have existing views affected by this bug will have to recreate them
after upgrading to get the corrected pg_get_viewdef output. (really
kicking myself for this.)
- Richard
| From | Date | Subject | |
|---|---|---|---|
| Next Message | PG Bug reporting form | 2026-02-27 09:09:36 | BUG #19420: Zombie FK exists after partition is detached. |
| Previous Message | yafei wu | 2026-02-27 07:44:12 | Re: BUG #19419: Cannot create custom functions using python3u |