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
Foreign table "sidecar_link.actions"
Column | Type | Collation | Nullable | Default | FDW options
-----------------+-----------------------------+-----------+----------+--------------------------------------------------+-------------
id | bigint | | not null | nextval('sidecar_link.actions_id_seq'::regclass) |
user_session_id | bigint | | not null | |
user_id | bigint | | not null | |
created_at | timestamp without time zone | | not null | now() |
occurred_at | timestamp without time zone | | not null | now() |
thing_id | integer | | | |
parent_thing_id | integer | | | |
viewing_id | integer | | | |
origin | origin | | | 'mysteryscience'::origin |
scope | text | | not null | |
name | text | | not null | |
details | text | | | |
request_path | text | | | |
Server: pg_mysterysci_sidecar
FDW options: (schema_name 'public', table_name 'actions')
Not really related question, but a curiosity: why does this table not show in the list of foreign tables?
=> \det
List of foreign tables
Schema | Table | Server
--------+-------+--------
(0 rows)
Foreign table "sidecar_link.actions"
Column | Type | Collation | Nullable | Default | FDW options
-----------------+-----------------------------+-----------+----------+--------------------------------------------------+-------------
id | bigint | | not null | nextval('sidecar_link.actions_id_seq'::regclass) |
user_session_id | bigint | | not null | |
user_id | bigint | | not null | |
created_at | timestamp without time zone | | not null | now() |
occurred_at | timestamp without time zone | | not null | now() |
thing_id | integer | | | |
parent_thing_id | integer | | | |
viewing_id | integer | | | |
origin | origin | | | 'mysteryscience'::origin |
scope | text | | not null | |
name | text | | not null | |
details | text | | | |
request_path | text | | | |
Server: pg_mysterysci_sidecar
FDW options: (schema_name 'public', table_name 'actions')
Not really related question, but a curiosity: why does this table not show in the list of foreign tables?
=> \det
List of foreign tables
Schema | Table | Server
--------+-------+--------
(0 rows)