Re: BUG #15781: subselect on foreign table (postgres_fdw) can crash (segfault)
От | Tom Lane |
---|---|
Тема | Re: BUG #15781: subselect on foreign table (postgres_fdw) can crash (segfault) |
Дата | |
Msg-id | 30638.1556224574@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: BUG #15781: subselect on foreign table (postgres_fdw) can crash (segfault) (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-bugs |
I wrote: > Well, that's just coincidental for the case where the problem fdw_expr is > a Param. I haven't tried to figure out exactly what upper-path generation > thinks it should put into fdw_exprs, but is it really only Params? Oh, this is interesting: regression=# explain verbose select exists(select c1 from ft4) as c, avg(c1) from ft4 where ft4.c1 = 42; QUERY PLAN ----------------------------------------------------------------------------------- Foreign Scan (cost=200.07..246.67 rows=1 width=33) Output: ($0), (avg(ft4.c1)) Relations: Aggregate on (public.ft4) Remote SQL: SELECT $1::boolean, avg(c1) FROM "S 1"."T 3" WHERE ((c1 = 42)) InitPlan 1 (returns $0) -> Foreign Scan on public.ft4 ft4_1 (cost=100.00..212.39 rows=3413 width=0) Remote SQL: SELECT NULL FROM "S 1"."T 3" (7 rows) That would crash if I tried to execute it, but: regression=# explain verbose select case when exists(select c1 from ft4) then 1 else 2 end as c, avg(c1) from ft4 where ft4.c1 = 42; QUERY PLAN ----------------------------------------------------------------------------------- Foreign Scan (cost=200.07..246.67 rows=1 width=36) Output: CASE WHEN $0 THEN 1 ELSE 2 END, (avg(ft4.c1)) Relations: Aggregate on (public.ft4) Remote SQL: SELECT avg(c1) FROM "S 1"."T 3" WHERE ((c1 = 42)) InitPlan 1 (returns $0) -> Foreign Scan on public.ft4 ft4_1 (cost=100.00..212.39 rows=3413 width=0) Remote SQL: SELECT NULL FROM "S 1"."T 3" (7 rows) That's just fine. So there is something stupid happening in creation of the fdw_scan_tlist when a relation tlist item is a bare Param, which doesn't happen if the same Param is buried in a larger expression. regards, tom lane
В списке pgsql-bugs по дате отправления: