IMPORT FOREIGN SCHEMA statement - Mailing list pgsql-hackers

From Ronan Dunklau
Subject IMPORT FOREIGN SCHEMA statement
Date
Msg-id 7379810.3t5YpdInZt@ronan.dunklau.fr
Whole thread Raw
Responses Re: IMPORT FOREIGN SCHEMA statement
Re: IMPORT FOREIGN SCHEMA statement
Re: IMPORT FOREIGN SCHEMA statement
List pgsql-hackers
Hello,

Since my last proposal didn't get any strong rebuttal, please find attached a
more complete version of the IMPORT FOREIGN SCHEMA statement.

I tried to follow the SQL-MED specification as closely as possible.

This adds discoverability to foreign servers. The structure of the statement
as I understand it is simple enough:

IMPORT FOREIGN SCHEMA remote_schema FROM SERVER some_server [ (LIMIT TO |
EXCEPT) table_list ] INTO local_schema.

The import_foreign_schema patch adds the infrastructure, and a new FDW
routine:

typedef List *(*ImportForeignSchema_function) (ForeignServer *server,
ImportForeignSchemaStmt * parsetree);

This routine must return a list of CreateForeignTableStmt mirroring whatever
tables were found on the remote side, which will then be executed.

The import_foreign_schema_postgres_fdw patch proposes an implementation of
this API for postgres_fdw. It will import a foreign schema using the right
types as well as nullable information.

Regarding documentation, I don't really know where it should have been put. If
I missed something, let me know and I'll try to correct it.


--
Ronan Dunklau
http://dalibo.com - http://dalibo.org
Attachment

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: SKIP LOCKED DATA (work in progress)
Next
From: Robert Haas
Date:
Subject: Re: SKIP LOCKED DATA (work in progress)