Re: Fwd: dblink_connect fails

From: Joe Conway <mail(at)joeconway(dot)com>
To: James Sewell <james(dot)sewell(at)lisasoft(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Fwd: dblink_connect fails
Date: 2015-12-17 03:06:21
Message-ID: 567226AD.4060002@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/16/2015 06:10 PM, James Sewell wrote:
> Oops left off the list.

Me too -- response repeated below...

> ---------- Forwarded message ----------
> From: *James Sewell* <james(dot)sewell(at)lisasoft(dot)com
> <mailto:james(dot)sewell(at)lisasoft(dot)com>>
> Date: Thursday, 17 December 2015
> Subject: dblink_connect fails
> To: Joe Conway <mail(at)joeconway(dot)com <mailto:mail(at)joeconway(dot)com>>
>
>
> On Thu, Dec 17, 2015 at 12:11 PM, Joe Conway <mail(at)joeconway(dot)com
> <javascript:_e(%7B%7D,'cvml','mail(at)joeconway(dot)com');>> wrote:
>
> On 12/16/2015 04:53 PM, James Sewell wrote:
> > No it is not.
> >
> > Just in case I tried setting it to 'postgres', logged in without -U
> > (doesn't work without PGUSER set) and tried the operation again.
>
> > > DETAIL: FATAL: role "PRDSWIDEGRID01$" does not exist

> This is a new database with some tables and dblink loaded.
>
> The PRDSWIDEGRID01 is actually the hostname - but I just can't see how
> it's getting injected.
>
> My understanding was that psql -U should override? And also that any
> user variable just sets the user PostgreSQL variable - which is postgres.

Hmmm, well the way you start up psql should be irrelevant here.

What goes on with dblink_connect() is more-or-less completely controlled
by libpq's PQconnectdb(). When you do not provide a user explicitly in
your libpq connect string it defaults to the user that the current
process is running under unless the PGUSER environment variable has been
defined. See:

http://www.postgresql.org/docs/9.4/interactive/libpq-envars.html

"The following environment variables can be used to select default
connection parameter values, which will be used by PQconnectdb,
PQsetdbLogin and PQsetdb if no value is directly specified by the
calling code.

PGUSER behaves the same as the user connection parameter."

-and-

http://www.postgresql.org/docs/9.4/interactive/libpq-connect.html#LIBPQ-PARAMKEYWORDS

"user

PostgreSQL user name to connect as. Defaults to be the same as
the operating system name of the user running the application."

So in your case, does your postgres server run as an OS user called
PRDSWIDEGRID01$ for some reason?

Joe

--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Frost 2015-12-17 03:29:03 Re: Check old and new tuple in row-level policy?
Previous Message Karl Czajkowski 2015-12-17 02:27:55 Re: Check old and new tuple in row-level policy?