pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #5775: DBLINK Connection String Truncation
2+ messages / 2 participants
[nested] [flat]

* BUG #5775: DBLINK Connection String Truncation
@ 2010-11-29 19:11  David Quinn-Jacobs <dqj@ecornell.com>
  0 siblings, 1 reply; 2+ messages in thread

From: David Quinn-Jacobs @ 2010-11-29 19:11 UTC (permalink / raw)
  To: pgsql-bugs


The following bug has been logged online:

Bug reference:      5775
Logged by:          David Quinn-Jacobs
Email address:      dqj@ecornell.com
PostgreSQL version: 9.0.1
Operating system:   Cent OS 5
Description:        DBLINK Connection String Truncation
Details: 

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

Note: I replaced the actual connection strings with equivalents, so the
position of truncation differed slightly.  The password was cut off, so the
connection failed.  The message is a bit incongruous with the actual
problem.

Note also that the code works fine in 8.4, but not 9.0.1.

Thank you!
-dqj



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #5775: DBLINK Connection String Truncation
@ 2010-11-29 23:55  Tom Lane <tgl@sss.pgh.pa.us>
  parent: David Quinn-Jacobs <dqj@ecornell.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2010-11-29 23:55 UTC (permalink / raw)
  To: David Quinn-Jacobs <dqj@ecornell.com>; +Cc: pgsql-bugs

"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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2010-11-29 23:55 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-11-29 19:11 BUG #5775: DBLINK Connection String Truncation David Quinn-Jacobs <dqj@ecornell.com>
2010-11-29 23:55 ` Tom Lane <tgl@sss.pgh.pa.us>

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