Postgres - CREATE FOREIGN TABLE based on other table

215 Views Asked by At

I'm looking way to simplify CREATE FOREIGN command, so do need to specify all columns and types.

What I'm doing now (using file_fdw server):

CREATE FOREIGN TABLE temp_table_csv 
(id integer, name text)
SERVER csv_log_server
OPTIONS ( filename 'path_to_file.csv', format 'csv');

What I would like to do:

CREATE FOREIGN TABLE temp_table_csv 
(like example_table)
SERVER csv_log_server
OPTIONS ( filename 'path_to_file.csv', format 'csv');

Using LIKE or similar command so Postgres can read structure out of there But it says "like is not supported"

0

There are 0 best solutions below