[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: Lookup Primary Key of Foreign Server's Table
From:       Chris Morris <chris () mysteryscience ! com>
Date:       2019-10-24 17:04:47
Message-ID: CALrUc2U-3gWM9qTbnHAsBX6i7zXpq8N-3UO9xE6NpXuSBd79qQ () mail ! gmail ! com
[Download RAW message or body]

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.
>
>

[Attachment #3 (text/html)]

<div dir="ltr">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.  <div><br></div><div>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&#39;t be able to handle right now, and I \
have to take care of that myself, which is easy enough to \
do.</div><div><br></div><div>Thx for the feedback.</div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 23, 2019 at 11:12 \
AM David G. Johnston &lt;<a \
href="mailto:david.g.johnston@gmail.com">david.g.johnston@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div \
dir="ltr"><div class="gmail_default" \
style="font-family:arial,helvetica,sans-serif"><span \
style="font-family:Arial,Helvetica,sans-serif">On Wed, Oct 23, 2019 at 8:47 AM Chris \
Morris &lt;<a href="mailto:chris@mysteryscience.com" \
target="_blank">chris@mysteryscience.com</a>&gt; wrote:</span><br></div></div><div \
class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div \
dir="ltr"><div>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&#39;s querying the local \
database, and not finding anything. In a schema dump of the local database, I \
don&#39;t see a primary key defined, so I&#39;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?</div></div></blockquote><div><br></div><div \
class="gmail_default" style="font-family:arial,helvetica,sans-serif">The \
documentation says doing what you suggest won&#39;t work...</div><div \
class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div \
class="gmail_default" style="font-family:arial,helvetica,sans-serif">David \
J.</div><div class="gmail_default" \
style="font-family:arial,helvetica,sans-serif"><br></div></div></div> \
</blockquote></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic