dblink for 8.4 should work without user-mappings - Mailing list pgsql-hackers

From Itagaki Takahiro
Subject dblink for 8.4 should work without user-mappings
Date
Msg-id 20090624111955.9477.52131E4D@oss.ntt.co.jp
Whole thread Raw
Responses Re: dblink for 8.4 should work without user-mappings  (Peter Eisentraut <peter_e@gmx.net>)
Re: dblink for 8.4 should work without user-mappings  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
contrib/dblink in 8.4 supports a server name by CREATE SERVER for connection
string, but it always requires an user-mapping (by CREATE USER MAPPING).
However, I think it should work user-mappings because it works when
the connection string is passed directly.

=# SELECT * FROM dblink('dbname=postgres', 'SELECT current_user') AS t(i name);
(ok)

=# CREATE FOREIGN DATA WRAPPER postgresql VALIDATOR postgresql_fdw_validator;
=# CREATE SERVER server1 FOREIGN DATA WRAPPER postgresql OPTIONS (dbname 'postgres');
=# SELECT * FROM dblink('server1', 'SELECT 1') AS t(i integer);
ERROR:  user mapping not found for "postgres"

The attached patch adds 'missing_ok' parameter to GetUserMapping() and
made dblink to use it. There should be no additional security issues here
because dblink's original security check works even for server name mode.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [PATCH] backend: compare word-at-a-time in bcTruelen
Next
From: Jeremy Kerr
Date:
Subject: Re: [PATCH] backend: compare word-at-a-time in bcTruelen