From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Tender Wang <tndrwang(at)gmail(dot)com>, Duncan Sands <duncan(dot)sands(at)deepbluecap(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: Attribute of type record has wrong type error with MERGE ... WHEN NOT MATCHED BY SOURCE THEN DELETE |
Date: | 2025-03-10 20:03:15 |
Message-ID: | CAEZATCUQjxowkRfG89YOWStPvJ3xpJW9wDNccnZOVJzSAHwJxA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Mon, 10 Mar 2025 at 19:11, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> I wrote:
> > Yeah, I think we can likely get away with that. We cannot back-patch
> > the changes that added relid to the outfuncs/readfuncs representation,
> > which means that the RTE's relid won't propagate to parallel workers,
> > but I don't see why they'd need it. We only need that info to get
> > as far as planning. I've not tried though.
>
> OK, the attached patch for v15 passes check-world, with or without
> force_parallel_mode. I'm inclined to commit the rewriteHandler.c
> and parsenodes.h bits in a separate patch for commit log visibility.
>
That looks good to me, on a quick read-through.
However, that's not quite the end of it -- preprocess_function_rtes()
/ inline_set_returning_function() can turn a function RTE into a
subquery RTE, leading to a similar problem:
create table foo (a int, b int);
insert into foo values (1,2);
create or replace function f() returns setof foo as
$$ select * from foo offset 0 $$ language sql stable;
update foo set b = f.b from f() as f(a,b) where f.a = foo.a returning f;
ERROR: attribute 3 of type record has wrong type
DETAIL: Table has type record, but query expects foo.
I tried looking for other places that change an RTE's rtekind, and
haven't managed to find any other problems, but may have missed
something.
Regards,
Dean
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-03-10 20:08:46 | Re: Attribute of type record has wrong type error with MERGE ... WHEN NOT MATCHED BY SOURCE THEN DELETE |
Previous Message | Tom Lane | 2025-03-10 20:00:01 | Re: BUG #18838: Missing characters in replication slot when bytea_output is set to "escape" |