libpq PQexecPrepared returns NULL

Lists: pgsql-interfaces
From: Gergely Czuczy <phoemix(at)harmless(dot)hu>
To: pgsql-interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: libpq PQexecPrepared returns NULL
Date: 2004-03-04 12:07:00
Message-ID: Pine.LNX.4.44.0403041305200.32728-100000@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

hello,

i've got a very strange problem, PQexecPrepared returns NULL, but if i
immadietly rerun the query it will run normally, returning the query
result. what can be the problem, and how could I track it down, solve it?

any suggestions welcome

bye,

Gergely Czuczy
mailto: phoemix(at)harmless(dot)hu
PGP: http://phoemix.harmless.hu/phoemix.pgp

The point is, that geeks are not necessarily the outcasts
society often believes they are. The fact is that society
isn't cool enough to be included in our activities.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gergely Czuczy <phoemix(at)harmless(dot)hu>
Cc: pgsql-interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: libpq PQexecPrepared returns NULL
Date: 2004-03-04 14:59:06
Message-ID: 25614.1078412346@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

Gergely Czuczy <phoemix(at)harmless(dot)hu> writes:
> i've got a very strange problem, PQexecPrepared returns NULL, but if i
> immadietly rerun the query it will run normally, returning the query
> result. what can be the problem, and how could I track it down, solve it?

Check PQerrorMessage().

AFAIR the only reasons for a null result (instead of a possibly-error
PGresult) would be out-of-memory or connection failure.

regards, tom lane


From: Gergely Czuczy <phoemix(at)harmless(dot)hu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: libpq PQexecPrepared returns NULL
Date: 2004-03-04 15:03:52
Message-ID: Pine.LNX.4.44.0403041602100.69-100000@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

hello

the strange thing is -- what i've forgot to mention -- is that
PQerrorMessage returns an empty string, so from this i don't know the
source of the error.

how can I check if it is _really_ out of memory?
i have 1G RAM in the box, and shm values are set:
kernel.shmmax = 536870912
kernel.shmall = 536870912

Bye,

Gergely Czuczy
mailto: phoemix(at)harmless(dot)hu
PGP: http://phoemix.harmless.hu/phoemix.pgp

The point is, that geeks are not necessarily the outcasts
society often believes they are. The fact is that society
isn't cool enough to be included in our activities.

On Thu, 4 Mar 2004, Tom Lane wrote:

> Gergely Czuczy <phoemix(at)harmless(dot)hu> writes:
> > i've got a very strange problem, PQexecPrepared returns NULL, but if i
> > immadietly rerun the query it will run normally, returning the query
> > result. what can be the problem, and how could I track it down, solve it?
>
> Check PQerrorMessage().
>
> AFAIR the only reasons for a null result (instead of a possibly-error
> PGresult) would be out-of-memory or connection failure.
>
> regards, tom lane
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gergely Czuczy <phoemix(at)harmless(dot)hu>
Cc: pgsql-interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: libpq PQexecPrepared returns NULL
Date: 2004-03-04 15:18:50
Message-ID: 25837.1078413530@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

Gergely Czuczy <phoemix(at)harmless(dot)hu> writes:
> the strange thing is -- what i've forgot to mention -- is that
> PQerrorMessage returns an empty string, so from this i don't know the
> source of the error.

That's messy. I'd recommend getting out a debugger and tracing through
it to see exactly where it's failing. Or put in some printf's. There
aren't that many paths that could return NULL. I guess one of them must
be forgetting to set PQerrorMessage, which seems like a bug to me. Let
us know what you find out.

regards, tom lane