BUG #18836: Cannot import foreign schema under different schema name when foreign table uses row types

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: mwisnicki(at)gmail(dot)com
Subject: BUG #18836: Cannot import foreign schema under different schema name when foreign table uses row types
Date: 2025-03-07 21:57:20
Message-ID: 18836-070c3c12d36a1331@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18836
Logged by: Marcin Wisnicki
Email address: mwisnicki(at)gmail(dot)com
PostgreSQL version: 16.8
Operating system: Linux
Description:

Assume foreign public schema has tables that use row types from the same
schema, e.g.

CREATE TABLE public.foo();
CREATE TABLE public.bar(foo public.foo);

If I try to import such schema under different local schema:

CREATE SCHEMA server1_foreign;
IMPORT FOREIGN SCHEMA public FROM SERVER server1 INTO server1_foreign;

Then such import will fail due to mismatched schema of rowtype:

> [42704] ERROR: type "public.foo" does not exist
> Where: importing foreign table "bar"

Since postgres knows it's importing public into server1_foreign it should do
the mapping on rowtypes within same schema.

Ideally there should also be an option to customize mapping of custom types
but the above IMHO should work out of the box.

I'm aware I can workaround the problem by importing all tables manually with
CREATE FOREIGN TABLE.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-03-07 23:36:39 Re: BUG #18834: Query planer is choosing the sub-optimal plan when limit is present
Previous Message Christopher Inokuchi 2025-03-07 20:53:03 Re: Window Functions with identical PARTITION BY and ORDER BY clauses evaluated separately