Re: SQL/MED - core functionality - Mailing list pgsql-hackers

From Shigeru HANADA
Subject Re: SQL/MED - core functionality
Date
Msg-id 20101213144516.AC9E.6989961C@metrosystems.co.jp
Whole thread Raw
In response to Re: SQL/MED - core functionality  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: SQL/MED - core functionality  (Hitoshi Harada <umi.tanuki@gmail.com>)
Re: SQL/MED - core functionality  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
On Sun, 12 Dec 2010 23:47:53 +0200
Peter Eisentraut <peter_e@gmx.net> wrote:
> On ons, 2010-12-01 at 12:30 +0900, Hitoshi Harada wrote:
> > From a user's view, this is very long way to see a simplest foreign
> > table. I know it is based on the standard, but I really want a
> > shortcut. Especially, I don't understand why CREATE USER MAPPING FOR
> > current_user SERVER <server> is needed for default use case. If you
> > forget CREATE USER MAPPING and do CREATE FOREIGN TABLE, it raises an
> > error. User mapping is useful if the local user and remote user should
> > be mapped but I imagine in most cases they are the same.
> > postgresql_fdw can tell the remote user by conninfo string, in
> > addition.
> 
> I reviewed the standard about this, and a lot of things are
> implementation-defined.  I think user mappings could be made optional.

Simple FDWs such as File FDW might not have concept of "user" on
remote side.  In such case, it would be enough to control access
privilege per local user with GRANT/REVOKE SELECT statement.

> > This is another topic, but it would be useful if CREATE FOREIGN TABLE
> > can omit column definitions since fdw usually knows what should be
> > there in the definitions. I some times mistyped the column names
> > between remote and local and resulted in fail on execution.
> 
> Also, according to the standard, the column list in CREATE FOREIGN TABLE
> is optional (if you can get it in some automatic way, of course).

To allow omitting column definitions for that purpose, a way to create
ero-column tables would have to be provided.  New syntax which allows
FDWs to determine column definition would be necessary.

ex)
-- Create foo from the remote table foo on the server bar
CREATE FOREIGN TABLE foo SERVER bar;
-- Create zero-column table foo
CREATE FOREIGN TABLE foo () SERVER bar;

To support this feature, another hook function need to be added to FDW
API.  ISTM that this feature should be considered with IMPORT SCHEMA
statement.

Regards,
--
Shigeru Hanada




pgsql-hackers by date:

Previous
From: KaiGai Kohei
Date:
Subject: rest of works for security providers in v9.1
Next
From: aaliya zarrin
Date:
Subject: pg_is_in_recovery=1