From: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org, exclusion(at)gmail(dot)com |
Subject: | Re: BUG #17344: Assert failed on queiring async_capable foreign table with inheritance |
Date: | 2021-12-25 23:26:25 |
Message-ID: | 20211225232625.5xuplnlegneh42cw@erthalion.local |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
> On Sat, Dec 25, 2021 at 10:00:01AM +0000, PG Bug reporting form wrote:
>
> create extension postgres_fdw;
> do $d$
> begin
> execute $$create server loopback foreign data wrapper postgres_fdw
> options (dbname '$$||current_database()||$$',
> port '$$||current_setting('port')||$$',
> async_capable 'true'
> )$$;
> end;
> $d$;
> create user mapping for current_user server loopback;
>
> create table tab1 (a int);
> insert into tab1 values(1), (2), (3);
> create foreign table ftab1 (b int) server loopback options (table_name
> 'tab1');
>
> create foreign table ftab2 () inherits (ftab1) server loopback;
> select a from tab1 where a in (select a from ftab1);
>
> With async_capable = 'false' I get expected results.
> But when ftab1 defined as
> create foreign table ftab1 (a int) server loopback options (table_name
> 'tab1');
> The select fails with:
> psql:query.sql:19: ERROR: could not connect to server "loopback"
> DETAIL: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL:
> sorry, too many clients already
> CONTEXT: remote SQL command: SELECT a FROM public.ftab2
> remote SQL command: SELECT a FROM public.ftab2
> remote SQL command: SELECT a FROM public.ftab2
> remote SQL command: SELECT a FROM public.ftab2
Apparently in both cases the second foreign scan of append ends up in
recursion:
-> Foreign Scan on public.ftab2 ftab1_2
Remote SQL: SELECT NULL FROM public.ftab2
This leads to a chain of the same cursor declarations:
DECLARE c1 CURSOR FOR SELECT a FROM public.ftab4
With a pattern:
bind -> new backend with the same declare -> execute -> bind -> ...
In the case of async foreign scan it hits limitation when no new
requests be sent while there is a pending one. In the second case it
hits connection limit. Shouldn't this type of foreign paths be avoided
by FDW?
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2021-12-27 03:53:30 | BUG #17345: pg_basebackup stucked for 2 hours before timeout |
Previous Message | PG Bug reporting form | 2021-12-25 10:00:01 | BUG #17344: Assert failed on queiring async_capable foreign table with inheritance |