Re: postgres_fdw does not see enums

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Fetter <david(at)fetter(dot)org>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: postgres_fdw does not see enums
Date: 2014-12-05 15:43:30
Message-ID: CAHyXU0xspvpOZRMBfLYEWAE-_0h2CfcXWWupvWDOHtOqzDfNTQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 3, 2014 at 5:17 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> David Fetter <david(at)fetter(dot)org> writes:
>> On Wed, Dec 03, 2014 at 05:52:03PM -0500, Tom Lane wrote:
>>> What do you mean "reconstruct the enum"?
>
>> Capture its state at the time when IMPORT FOREIGN SCHEMA is executed.
>> Right now, if you try IMPORT SCHEMA on a foreign table with an enum in
>> it, postgresql_fdw errors out rather than trying to notice that
>> there's an enum definition which should precede creation and execute
>> it in the correct order.
>
> Oh, you think IMPORT FOREIGN SCHEMA should try to import enums?
> I doubt it. What happens if the enum already exists locally?
> And why enums, and not domains, ranges, composite types, etc?

Probably IMPORT FOREIGN SCHEMA should not attempt to include type
dependencies.

However, if they are present in the importer (that is, the type exists
by name), it should assume that they are correct come what may.
Something like 'IMPORT FOREIGN TYPE' would probably be needed to
translate a type between servers. Unless the SQL standard has it or
gets it I doubt it will ever appear but the status quo isn't too bad
IMO. Personally I have no issues with the risks involved with type
synchronizion; the problems faced are mostly academic with clean
errors and easily managed unless binary format is used with postgres
to postgres transfer (which IIRC the postgres fdw does not utilize at
this time).

User created types can't be transmitted between servers with the
existing binary format; you have to transmit them as text and hope the
structures agree. Binary format transmission in postgres tends to be
quite a bit faster depending on the nature of the types involved,
things like ints, numerics, and timestamps tend to be much faster.

merlin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2014-12-05 15:45:23 Re: Yet another abort-early plan disaster on 9.3
Previous Message Andres Freund 2014-12-05 15:17:50 Re: [REVIEW] Re: Compression of full-page-writes