Re: Lookup Primary Key of Foreign Server's Table - Mailing list pgsql-general

From Chris Morris
Subject Re: Lookup Primary Key of Foreign Server's Table
Date
Msg-id CALrUc2U-3gWM9qTbnHAsBX6i7zXpq8N-3UO9xE6NpXuSBd79qQ@mail.gmail.com
Whole thread Raw
In response to Re: Lookup Primary Key of Foreign Server's Table  ("David G. Johnston" <david.g.johnston@gmail.com>)
List 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.g.johnston@gmail.com> wrote:
On Wed, Oct 23, 2019 at 8:47 AM Chris Morris <chris@mysteryscience.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.

pgsql-general by date:

Previous
From: Carlos Martinez
Date:
Subject: Recover databases from raw files (only exists the base directory)
Next
From: Laurenz Albe
Date:
Subject: Re: Recover databases from raw files (only exists the basedirectory)