Re: Lookup Primary Key of Foreign Server's Table

From: Chris Morris <chris(at)mysteryscience(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Lookup Primary Key of Foreign Server's Table
Date: 2019-10-24 17:04:47
Message-ID: CALrUc2U-3gWM9qTbnHAsBX6i7zXpq8N-3UO9xE6NpXuSBd79qQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yeah. Part of my confusion is due to Heroku providing a Data Links service
that handles a lot of the internal details around establishing a
foreign server connection, and not knowing exactly what to expect.

I experimented with IMPORT FOREIGN SCHEMA in a couple of test databases and
noticed that there was no declaration of primary key brought over to the
local database. So, this is something ActiveRecord simply won't be able to
handle right now, and I have to take care of that myself, which is easy
enough to do.

Thx for the feedback.

On Wed, Oct 23, 2019 at 11:12 AM David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> On Wed, Oct 23, 2019 at 8:47 AM Chris Morris <chris(at)mysteryscience(dot)com>
> wrote:
>
>> The foreign table has a primary key. Ruby on Rails uses a system query to
>> lookup what the primary key on the table is, but it's querying the local
>> database, and not finding anything. In a schema dump of the local database,
>> I don't see a primary key defined, so I'm presuming I need to issue an ADD
>> CONSTRAINT command against the foreign table to reflect what is actually
>> true in the foreign table? Is that correct?
>>
>
> The documentation says doing what you suggest won't work...
>
> David J.
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2019-10-24 19:09:30 Re: Recover databases from raw files (only exists the base directory)
Previous Message Carlos Martinez 2019-10-24 16:55:59 Recover databases from raw files (only exists the base directory)