Sample Header Ad - 728x90

How I can create a foreign table using a foreign data wrapper that references to a remote one with the same name?

0 votes
1 answer
859 views
I have 2 databases one named logs that has the table:
http_log:
id: serial
method: Varchar(10)
url: varchar(150)
I also have an another database named archiving that also has a table named http_log:
http_log:
id: unsinged integer
method: Varchar(10)
url: varchar(150)
How I can create the foreign table archived_http_log so I can transfer data from the http_log to archived_http_log. I cannot have a table with the same name in my postgresql therefore I cannot have 2 tables named http_log. What I want top achieve is via a single SQL script to transfer data from logs.http_log to archiving.http_log. So in a server to run:
INSERT INTO archived_http_log VALUES (SELECT * from http_log);
Asked by Dimitrios Desyllas (873 rep)
Jan 19, 2022, 04:09 PM
Last activity: Jan 20, 2022, 03:10 AM