Skip site navigation (1) Skip section navigation (2)

Re: BUG #5775: DBLINK Connection String Truncation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David Quinn-Jacobs" <dqj(at)ecornell(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5775: DBLINK Connection String Truncation
Date: 2010-11-29 23:55:06
Message-ID: 7599.1291074906@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"David Quinn-Jacobs" <dqj(at)ecornell(dot)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

In response to

pgsql-bugs by date

Next:From: Bruce MomjianDate: 2010-11-30 03:11:44
Subject: Re: BUG #5768: Inefficiency of large offsets should be mentioned on SELECT documentation page
Previous:From: David Quinn-JacobsDate: 2010-11-29 19:11:19
Subject: BUG #5775: DBLINK Connection String Truncation

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group