I'm trying, using the PostgreSQL Maestro tool, to reference a foreign key coming from a "local" DB to an other primary key inside an other DB (actually, they're both on the same remote machine). I've heard about the postgres_fdw module to create a foreign table that act like a copy of the table inside the remote DB, but when I try to execute my query I have this error:
"SQL Error: ERROR: referenced relation "foreign_olo" is not a table".
This is my sql code:
CREATE TABLE edb.olo_config (
primary_key integer NOT NULL PRIMARY KEY,
puntamento varchar,
mail_contatto_to varchar,
mail_contatto_cc varchar,
/* Foreign keys */
CONSTRAINT olo_code
FOREIGN KEY (olo_code)
REFERENCES edb.foreign_olo(codice_operatore)
) WITH (
OIDS = FALSE
);
foreign_olo is my foreign table created with postgres_fdw. I have tried to commit an INSERT or a simple SELECT on the foreign_olo table, and all went well, so I can't understand why for the foreign key case it can't be recognized as a table. Thank you to everyone would give me an hand!