=?UTF-8?B?THVrw6HFoSBTb2JvdGth?= <sobotka.luk@gmail.com> writes:
> I would be grateful for some help. I am writing you because I am confused
> about using data foreign wrappers and dblink. I attached simplified script
> describing the problem.
I think what is happening is that postgres_fdw starts a transaction on
its connection as soon as it's asked to do something, and then the CREATE
TABLE executed on dblink's separate connection isn't visible to that
already-in-progress transaction.
That theory only holds up if you are running in serializable mode (which
postgres_fdw would then also use for its remote transaction). Which you
didn't say, but it's hard to see how it'd fail otherwise.
regards, tom lane