Foreign table feedback

From: Thom Brown <thom(at)linux(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Foreign table feedback
Date: 2013-03-14 13:52:39
Message-ID: CAA-aLv48CWZH03u0qfF0=TNhJtKkcdQXmppMt2-Tu62XV9k2=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-03-14 14:14:43 Re: Foreign table feedback
Previous Message Heikki Linnakangas 2013-03-14 13:44:19 Re: Statistics and selectivity estimation for ranges