Re: libpq on windows

Поиск
Список
Период
Сортировка
От Gustavo Lopes
Тема Re: libpq on windows
Дата
Msg-id 2b5c484b05052009545a310cd7@mail.gmail.com
обсуждение исходный текст
Ответ на Re: libpq on windows  (Gustavo Lopes <contratempo@gmail.com>)
Ответы Re: libpq on windows  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-interfaces
Actually it seems the hints are not the problem. I see no pattern now.
For instance, if table "j" doesn't exist, "drop table j" is ok but not
"drop table".

Gustavo Lopes

On 20/05/05, Gustavo Lopes <contratempo@gmail.com> wrote:
> No, I'd say the notice processor/receiver is not the problem since
> I've been able to implement a notice receiver that would display the
> received notices without any complications.
> The problem seems to arise only when a message contains a HINT
> attached (I don't even know whether messages of type NOTICE can
> cointain a hint field, but anyway that doesn't seem relevant to this
> issue).
>
> Gustavio Lopes
>
> On 20/05/05, jtv@xs4all.nl <jtv@xs4all.nl> wrote:
> > Gustavo Lopes <contratempo@gmail.com> wrote:
> >
> > > The problem seems to occurr only when the server sends a hint or the
> > > dll generates one. This can happen when the connection to the server
> > > cannot be established because the server is not running, a nonexistant
> > > postgres function exist is called, when one attempts to drop an index
> > > upon which a constraint depends, etc. (the program doesn't go beyond
> > > PQconnectdb, PQexec or PQexecparam). Since my debugging skills are
> > > very poor I cannot give any accurate description on what is causing
> > > the exception.
> > > The problem can be very easily reproduced by creating a C program
> > > which calls PQconnectdb with a host parameter that points to a machine
> > > that is not running postgres.
> > > Running the same program under linux (although I used older versions
> > > of the interface and the server) does not cause any problems.
> >
> > It could be the notice processor that crashes.  A "notice processor" is a
> > callback that you can register with libpq that handles error messages.
> > The default is to print them to the console, but I'm not sure you can
> > always do that in a Windows program.  Or since you're apparently using
> > different compilers for libpq and the application, maybe the default
> > notice processor gets linked to a different standard library than it
> > expects and fails because of that.
> >
> > Notice processors are documented here:
> >
> > http://www.postgresql.org/docs/8.0/interactive/libpq-notice-processing.html
> >
> > To find out if this is what's wrong, try creating an empty function (with
> > C-style calling convention, not a regular C++ function) and setting that
> > as the notice processor:
> >
> >   extern "C" { /* (this line only needed in C++) */
> >   void emptynoticeprocessor(void *, const char *)
> >   {
> >   }
> >   } /* (this line only needed in C++) */
> >
> > Now in your code, just after you opened your connection (call it "c"):
> >
> >   PQsetNoticeProcessor(c,emptynoticeprocessor,NULL);
> >
> > Of course that will mean that error messages are not displayed, so if this
> > solves your crashing problem then your next step is to implement something
> > here that displays the given message!
> >
> > Jeroen
> >
> >
>


В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Gustavo Lopes
Дата:
Сообщение: Re: libpq on windows
Следующее
От: Tom Lane
Дата:
Сообщение: Re: libpq on windows