pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: mwisnicki@gmail.com
Subject: BUG #18836: Cannot import foreign schema under different schema name when foreign table uses row types
Date: Fri, 07 Mar 2025 21:57:20 +0000
Message-ID: <18836-070c3c12d36a1331@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18836
Logged by:          Marcin Wisnicki
Email address:      mwisnicki@gmail.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.



view thread (3+ messages)  latest in thread

Message-ID: <18836-070c3c12d36a1331@postgresql.org>
Permalink:  ../18836-070c3c12d36a1331@postgresql.org/
Also on:    postgresql.org/message-id/18836-070c3c12d36a1331@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, mwisnicki@gmail.com
  Subject: Re: BUG #18836: Cannot import foreign schema under different schema name when foreign table uses row types
  In-Reply-To: <18836-070c3c12d36a1331@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox