Re: Attribute of type record has wrong type error with MERGE ... WHEN NOT MATCHED BY SOURCE THEN DELETE

Поиск
Список
Период
Сортировка
От Dean Rasheed
Тема Re: Attribute of type record has wrong type error with MERGE ... WHEN NOT MATCHED BY SOURCE THEN DELETE
Дата
Msg-id CAEZATCUQjxowkRfG89YOWStPvJ3xpJW9wDNccnZOVJzSAHwJxA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Attribute of type record has wrong type error with MERGE ... WHEN NOT MATCHED BY SOURCE THEN DELETE  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Attribute of type record has wrong type error with MERGE ... WHEN NOT MATCHED BY SOURCE THEN DELETE
Re: Attribute of type record has wrong type error with MERGE ... WHEN NOT MATCHED BY SOURCE THEN DELETE
Список pgsql-bugs
On Mon, 10 Mar 2025 at 19:11, Tom Lane <tgl@sss.pgh.pa.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



В списке pgsql-bugs по дате отправления: