Re: Lookup Primary Key of Foreign Server's Table

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Chris Morris <chris(at)mysteryscience(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-22 16:35:17
Message-ID: CAKFQuwZOwKGWFM9ockGEfvVcNAfMpHhnLV9EpZ2he1m+otG=Ew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Oct 22, 2019 at 9:16 AM Chris Morris <chris(at)mysteryscience(dot)com>
wrote:

> I'm looking for a system query that will lookup the primary key column on
> a fdw table. It's possible we need to declare that part of the foreign
> table's schema in the local (is that the right term?) database?
>
> Here's the foreign table - I don't see anything showing a primary key, so
> my hunch is we need to declare it in the local schema?
>
> *=> \d sidecar_link.actions*
>

I'm not seeing anything in the local FDW table definition that deals with
PK/FK constraints so I'm led to believe that what you are asking is not
possible. Consider detailing what your goal is and not just your technical
need.

>
> Not really related question, but a curiosity: why does this table not show
> in the list of foreign tables?
>

I suspect for the same reason you added the schema prefix "sidecar_link" to
the table name when you issued \d above.

>
>
>
>
>
>
> *=> \det List of foreign tables Schema | Table | Server
> --------+-------+--------(0 rows)*
>

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message stan 2019-10-22 17:14:23 An issue installing an extension
Previous Message Chris Morris 2019-10-22 16:16:05 Lookup Primary Key of Foreign Server's Table