Foreign table feedback - Mailing list pgsql-hackers

From Thom Brown
Subject Foreign table feedback
Date
Msg-id CAA-aLv48CWZH03u0qfF0=TNhJtKkcdQXmppMt2-Tu62XV9k2=Q@mail.gmail.com
Whole thread Raw
Responses Re: Foreign table feedback  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi all,

Is there a way to ensure we don't end up with a foreign table feedback loop?

For example:

CREATE SERVER pgserver FOREIGN DATA WRAPPER postgres_fdw OPTIONS (dbname 'postgres');

-- note how I've forgotten to specify host or port

CREATE USER MAPPING FOR PUBLIC SERVER pgserver;

CREATE FOREIGN TABLE test (id int) SERVER pgserver;

postgres=# SELECT * FROM test;
FATAL:  sorry, too many clients already
ERROR:  could not connect to server "pgserver"
DETAIL:  FATAL:  sorry, too many clients already
STATEMENT:  DECLARE c1 CURSOR FOR
SELECT id FROM public.test
ERROR:  could not connect to server "pgserver"
DETAIL:  FATAL:  sorry, too many clients already
CONTEXT:  Remote SQL command: SELECT id FROM public.test
STATEMENT:  FETCH 100 FROM c1
ERROR:  could not connect to server "pgserver"
DETAIL:  FATAL:  sorry, too many clients already
...

This of course carries on until there's 100 lines in the CONTEXT
message, and all connections, which remain in use after the error.

Of course the same issue happens if you try to create a foreign table
to another foreign table on another server, which points back to the
one you're creating.
--
Thom



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Statistics and selectivity estimation for ranges
Next
From: Tom Lane
Date:
Subject: Re: Foreign table feedback