On Thu, 3 Dec 2026 at 08:55, shihao zhong <[email protected]> wrote:
>
> Hi Kirill,

Hi! Thanks for looking into this.

> Thanks for the report. The same race hits every command that looks up a
> server by name. With your fix I still get "cache lookup failed" from
> ALTER USER MAPPING and DROP USER MAPPING. CREATE FOREIGN TABLE and
> IMPORT FOREIGN SCHEMA fail the same way. Maybe one shared helper that
> takes the lock could fix them all?

Yes indeed. I reproduced same issue with

 CREATE USER MAPPING
 ALTER USER MAPPING
 DROP USER MAPPING
 CREATE FOREIGN TABLE
 IMPORT FOREIGN SCHEMA

 CREATE SUBSCRIPTION ... SERVER
 ALTER SUBSCRIPTION ... SERVER.

five mapping/table/import statements all return XX000. The two
subscription statements report ERROR: cache lookup failed for foreign
server <oid>

Attached fixes this using a helper function in all call sites.

>
> Also, with the fix your test no longer reaches the injection point, I think 
> this is just for
> reproduce, not for submit?


Yes



-- 
Best regards,
Kirill Reshke

Attachment: 0001-lock-foreign-server-lookups.diff
Description: Binary data

Reply via email to