pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Quinn-Jacobs <dqj@ecornell.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #5775: DBLINK Connection String Truncation
Date: Mon, 29 Nov 2010 18:55:06 -0500
Message-ID: <7599.1291074906@sss.pgh.pa.us> (raw)
In-Reply-To: <201011291911.oATJBJ1o071307@wwwmaster.postgresql.org>
References: <201011291911.oATJBJ1o071307@wwwmaster.postgresql.org>

"David Quinn-Jacobs" <dqj@ecornell.com> writes:
> Causes connection failure.  To re-create:

> CREATE TABLE Local ( foo TEXT );
> CREATE TABLE Remote ( bar TEXT );
> CREATE VIEW DblinkBugView AS 
> 	SELECT * FROM Local L
> 		LEFT OUTER JOIN dblink( 'hostname=123.456.789.012
> dbname=a_longish_database_name user=my_user_name password=my_password',
> 			'SELECT bar FROM Remote' ) AS R ( bar TEXT ) ON (L.foo=R.bar);

> The sample case can have both tables located on the same server to simplify.
>  The error message is not just generated.  The string is actually truncated,
> as demonstrated in the psql command result:

> mydb=# SELECT * FROM DblinkBugView;
> NOTICE:  identifier "host=123.456.789.012 dbname=a_longish_database_name
> user=my_user_name password=my_password" will be truncated to
> "host=123.456.789.012 dbname=a_longish_database_name user=my_user_name p"
> ERROR:  could not establish connection
> DETAIL:  FATAL:  no pg_hba.conf entry for host "123.456.789.012", user
> "my_user_name", database "a_longish_database_name", SSL off

Well, it works for me, as nearly as I can replicate this test case.
I get the bogus NOTICE but the connection goes through anyway:

contrib_regression=# SELECT * FROM DblinkBugView;
NOTICE:  identifier "host=127.0.0.1
dbname=contrib_regression                user=postgres" will be truncated to "host=127.0.0.1
dbname=contrib_regression                user=po"
 foo | bar 
-----+-----
(0 rows)

Please notice that the connection error you are getting is *not* about a
bad password.  It looks like you've neglected to provide a pg_hba.conf
entry that will allow dblink connections.

			regards, tom lane



view thread (2+ messages)

Message-ID: <7599.1291074906@sss.pgh.pa.us>
Permalink:  ../7599.1291074906@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7599.1291074906@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dqj@ecornell.com
  Subject: Re: BUG #5775: DBLINK Connection String Truncation
  In-Reply-To: <7599.1291074906@sss.pgh.pa.us>
  References: <201011291911.oATJBJ1o071307@wwwmaster.postgresql.org> <7599.1291074906@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox