Re: SQL/MED compatible connection manager - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: SQL/MED compatible connection manager
Date
Msg-id 49AE818C.6080408@gmx.net
Whole thread Raw
In response to Re: SQL/MED compatible connection manager  (Martin Pihlak <martin.pihlak@gmail.com>)
Responses Re: SQL/MED compatible connection manager  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: SQL/MED compatible connection manager  (David Fetter <david@fetter.org>)
Re: SQL/MED compatible connection manager  (Martin Pihlak <martin.pihlak@gmail.com>)
List pgsql-hackers
Martin Pihlak wrote:
> Proposal attached. This adds two C functions:
> 
> List *GetForeignConnectionOptions(Oid serverid, Oid userid);
> char *GetForeignConnectionString(Oid serverid, Oid userid);
> 
> One for obtaining all of the connection related options as a list, and
> another for transforming these options into a libpq conninfo string.
> The latter should be useful for dblink (although the userid and serverid
> need to be obtained first).
> 
> On top of those there are two SQL accessible functions:
> 
> pg_foreign_connection_options(server name, user name = current_user,
>     OUT option_class text, OUT option_name text, OUT option_value text);
> 
> pg_foreign_connection_string(server name, user  name = current_user);
> 
> These should initially be restricted from ordinary users -- grant explicitly
> if the user should see the connect strings.

Back to this one ...

I have been thinking about this for a great while now.  I am not yet 
comfortable with how we manage the access rights here.  We have 
restricted access to the user mappings catalog to hide passwords, but it 
is not entirely clear why a password must be stored in a user mapping. 
It could also be stored with a server, if we only want to use one global 
connection for everybody.

I think the proper way to handle it might be to introduce a new 
privilege type -- call it SELECT if you like -- that determines 
specifically whether you can *see* the options of a foreign-data 
wrapper, foreign server, or user mapping, respectively.  As opposed to 
USAGE, which means you can use the object for connecting (in the 
future).  This might have other uses: The owner of a server might want 
to hide the host name, but still let you connect.

Comments?



pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: Regclass and quoted table names
Next
From: Heikki Linnakangas
Date:
Subject: Re: SIGHUP during recovery