Thread: notice handler in libpq-based driver

notice handler in libpq-based driver

From
"Scot Loach"
Date:
With the new driver I sometimes see messages being printed to stderr, obviously the ODBC driver should not do this.
I believe the PQnoticeProcessor needs to be set, see this documentation for details of how this works.
http://www.postgresql.org/docs/7.4/interactive/libpq-notice-processing.html

It should be trivial to add this but I'm not sure what the best place to do it would be, would one of the maintainers
beable to do it? 




Re: notice handler in libpq-based driver

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgsql-odbc-owner@postgresql.org
> [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Scot Loach
> Sent: 06 September 2005 19:18
> To: pgsql-odbc@postgresql.org
> Subject: [ODBC] notice handler in libpq-based driver
>
> With the new driver I sometimes see messages being printed to
> stderr, obviously the ODBC driver should not do this.
> I believe the PQnoticeProcessor needs to be set, see this
> documentation for details of how this works.
> http://www.postgresql.org/docs/7.4/interactive/libpq-notice-pr
> ocessing.html
>
> It should be trivial to add this but I'm not sure what the
> best place to do it would be, would one of the maintainers be
> able to do it?

No, I'm not sure how to handle this either - the old driver handled it
in the socket code along with other messages. I'm not sure how, with the
noticeProcessor, we would associate notices with specific statements or
connections.

I suppose we could just store them all someplace, and check/empty the
list after each libpq_execute.

Anoop, what do you think?

Regards, Dave.

Re: notice handler in libpq-based driver

From
Tom Lane
Date:
"Dave Page" <dpage@vale-housing.co.uk> writes:
> No, I'm not sure how to handle this either - the old driver handled it
> in the socket code along with other messages. I'm not sure how, with the
> noticeProcessor, we would associate notices with specific statements or
> connections.

IIRC, the notice processor is passed a void pointer that you specify
when you set up the notice hook.  Typically you'd give it a pointer to
your own data structure describing the connection.  It should be able to
find out whatever it needs to know from there.

            regards, tom lane

Re: notice handler in libpq-based driver

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgsql-odbc-owner@postgresql.org
> [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Tom Lane
> Sent: 07 September 2005 15:49
> To: Dave Page
> Cc: Scot Loach; pgsql-odbc@postgresql.org; Anoop Kumar
> Subject: Re: [ODBC] notice handler in libpq-based driver
>
> "Dave Page" <dpage@vale-housing.co.uk> writes:
> > No, I'm not sure how to handle this either - the old driver
> handled it
> > in the socket code along with other messages. I'm not sure
> how, with the
> > noticeProcessor, we would associate notices with specific
> statements or
> > connections.
>
> IIRC, the notice processor is passed a void pointer that you specify
> when you set up the notice hook.

Ahh yes, so it does. Thanks Tom.

Regards, Dave