IMPORT FOREIGN SCHEMA statement

From: Ronan Dunklau <ronan(dot)dunklau(at)dalibo(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: IMPORT FOREIGN SCHEMA statement
Date: 2014-05-23 20:08:06
Message-ID: 7379810.3t5YpdInZt@ronan.dunklau.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
import_foreign_schema_v1.patch text/x-patch 20.4 KB
import_foreign_schema_postgres_fdw_v1.patch text/x-patch 10.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-05-23 20:18:54 Re: SKIP LOCKED DATA (work in progress)
Previous Message Pavel Stehule 2014-05-23 19:31:52 Re: SKIP LOCKED DATA (work in progress)