PG FDW query fails, works local, same credentials

From: "Pete O'Such" <posuch(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: PG FDW query fails, works local, same credentials
Date: 2023-08-31 03:52:35
Message-ID: CAEdngj828Z=6gfHxq1-Q0uLW6YkzP3-EeSuw1E7ZxSiMuvnpVA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I've got a view on server A (PG 15.2) that fails when queried via FDW from
server B (also PG 15.2). Querying it as a foreign table from server B
yields a message like "ERROR: function blah(type) does not exist".

Confusingly, I succeed when: I log into server A, set my role to match the
role used with the FDW, and query with the exact query text that server B
sent to server A (according to the error on server B).

The function that it complains about does exist, and I have made the effort
to provide appropriate grants to the role in question. So it does work as
expected from within server A, as the same role. But why would it then fail
from server B?

Both cases use the same role/credentials. Plenty of other foreign tables
work in this same setup between these two servers, whether pointing to
tables or views. I hit and resolved similar issues earlier where the role
lacked necessary grants. Having experienced it before, this time I'm
pretty sure that the right grants are in place, yet it still fails when
used via FDW.

I'm running out of things to try and wondering if this will turn out to be
a bug. What should I be trying before reporting it as a bug?

Thanks,
Pete

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2023-08-31 04:46:28 Re: PG FDW query fails, works local, same credentials
Previous Message Dimitrios Apostolou 2023-08-30 21:52:12 Re: Partitionwise JOIN scanning all partitions, even unneeded ones