Thread: How to determine failed connection attempt due to invalid authorization (libpq)?

How to determine failed connection attempt due to invalid authorization (libpq)?

From
Dmitriy Igrishin
Date:
Hey all,<br /><br />Is there way to determine failed connection attempt due to invalid authorization (libpq)?<br /><br
/>--<br />// Dmitriy.<br /><br /> 
On Thu, Oct 14, 2010 at 2:59 PM, Dmitriy Igrishin <dmitigr@gmail.com> wrote:
> Is there way to determine failed connection attempt due to invalid
> authorization (libpq)?

I think this question would be more appropriate on pgsql-general.  I
suppose you would have to look at PQerrorMessage().

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: How to determine failed connection attempt due to invalid authorization (libpq)?

From
Dmitriy Igrishin
Date:
Hey Robert,<br /><br />I've asked pgsql-general.<br />Unfortunately it seems that there is no better way to do it
except<br/>parsing PQerrorMessage(). Sadly.<br /><br /><br /><div class="gmail_quote">2010/10/17 Robert Haas <span
dir="ltr"><<ahref="mailto:robertmhaas@gmail.com">robertmhaas@gmail.com</a>></span><br /><blockquote
class="gmail_quote"style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left:
1ex;"><divclass="im">On Thu, Oct 14, 2010 at 2:59 PM, Dmitriy Igrishin <<a
href="mailto:dmitigr@gmail.com">dmitigr@gmail.com</a>>wrote:<br /> > Is there way to determine failed connection
attemptdue to invalid<br /> > authorization (libpq)?<br /><br /></div>I think this question would be more
appropriateon pgsql-general.  I<br /> suppose you would have to look at PQerrorMessage().<br /><font
color="#888888"><br/> --<br /> Robert Haas<br /> EnterpriseDB: <a href="http://www.enterprisedb.com"
target="_blank">http://www.enterprisedb.com</a><br/> The Enterprise PostgreSQL Company<br
/></font></blockquote></div><br/><br clear="all" /><br />-- <br />// Dmitriy.<br /><br /><br /> 
On Sun, Oct 17, 2010 at 2:03 AM, Dmitriy Igrishin <dmitigr@gmail.com> wrote:
> I've asked pgsql-general.
> Unfortunately it seems that there is no better way to do it except
> parsing PQerrorMessage(). Sadly.

Yeah, doesn't look like it.  A quick glance at the code reveals that a
PGresult can store individual error fields but a PGconn can store only
a message.   :-(

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


On Mon, Oct 18, 2010 at 10:03:55AM -0400, Robert Haas wrote:
> On Sun, Oct 17, 2010 at 2:03 AM, Dmitriy Igrishin <dmitigr@gmail.com> wrote:
> > I've asked pgsql-general.
> > Unfortunately it seems that there is no better way to do it except
> > parsing PQerrorMessage(). Sadly.
> 
> Yeah, doesn't look like it.  A quick glance at the code reveals that a
> PGresult can store individual error fields but a PGconn can store only
> a message.   :-(

Does this seem worth patching for 9.1?

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


On Mon, Oct 18, 2010 at 10:05 AM, David Fetter <david@fetter.org> wrote:
> On Mon, Oct 18, 2010 at 10:03:55AM -0400, Robert Haas wrote:
>> On Sun, Oct 17, 2010 at 2:03 AM, Dmitriy Igrishin <dmitigr@gmail.com> wrote:
>> > I've asked pgsql-general.
>> > Unfortunately it seems that there is no better way to do it except
>> > parsing PQerrorMessage(). Sadly.
>>
>> Yeah, doesn't look like it.  A quick glance at the code reveals that a
>> PGresult can store individual error fields but a PGconn can store only
>> a message.   :-(
>
> Does this seem worth patching for 9.1?

Please feel free to submit a patch if you have an idea how to solve it.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


On Mon, Oct 18, 2010 at 10:18:25AM -0400, Robert Haas wrote:
> On Mon, Oct 18, 2010 at 10:05 AM, David Fetter <david@fetter.org> wrote:
> > On Mon, Oct 18, 2010 at 10:03:55AM -0400, Robert Haas wrote:
> >> On Sun, Oct 17, 2010 at 2:03 AM, Dmitriy Igrishin <dmitigr@gmail.com> wrote:
> >> > I've asked pgsql-general.
> >> > Unfortunately it seems that there is no better way to do it except
> >> > parsing PQerrorMessage(). Sadly.
> >>
> >> Yeah, doesn't look like it.  A quick glance at the code reveals that a
> >> PGresult can store individual error fields but a PGconn can store only
> >> a message.   :-(
> >
> > Does this seem worth patching for 9.1?
> 
> Please feel free to submit a patch if you have an idea how to solve it.

Will look that over this evening and submit an idea for a patch :)

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


On Mon, Oct 18, 2010 at 07:26:32AM -0700, David Fetter wrote:
> On Mon, Oct 18, 2010 at 10:18:25AM -0400, Robert Haas wrote:
> > On Mon, Oct 18, 2010 at 10:05 AM, David Fetter <david@fetter.org> wrote:
> > > On Mon, Oct 18, 2010 at 10:03:55AM -0400, Robert Haas wrote:
> > >> On Sun, Oct 17, 2010 at 2:03 AM, Dmitriy Igrishin <dmitigr@gmail.com> wrote:
> > >> > I've asked pgsql-general.
> > >> > Unfortunately it seems that there is no better way to do it except
> > >> > parsing PQerrorMessage(). Sadly.
> > >>
> > >> Yeah, doesn't look like it.  A quick glance at the code reveals that a
> > >> PGresult can store individual error fields but a PGconn can store only
> > >> a message.   :-(
> > >
> > > Does this seem worth patching for 9.1?
> > 
> > Please feel free to submit a patch if you have an idea how to solve it.
> 
> Will look that over this evening and submit an idea for a patch :)

I'm pretty slammed by some other commitments at the moment.  Probably
won't get a chance to do this until at least this weekend.

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate