Re: [GENERAL] PQgetvalue weirdness

From: Chris Johnson <cmj(at)inline-design(dot)com>
To: Simon Drabble <madlather(at)syspac(dot)com>
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] PQgetvalue weirdness
Date: 1998-09-10 19:10:01
Message-ID: Pine.LNX.4.00.9809101507450.15980-100000@boreus.bedfo.ma.tiac.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I usually use pg_result... here is a snipped of some C I have used:

<<<>>>
for (i = 0; i < PQntuples(res); i++)
{
dbName = PQgetvalue(res, i, 0);
<<<>>>

It works perfectly on the Linux, IRIX and Digital Unix (OSF/1)... Assuming
all the regression tests worked when you installed, and that you are
linking your program with the proper libpq, I guess the next step is to
see more of the code and to know exactly how you compiled it.

Chris

--
A language that doesn't affect the way you think about programming is
not worth knowing.

On Thu, 10 Sep 1998, Simon Drabble wrote:

>
>
> On Thu, 10 Sep 1998, Chris Johnson wrote:
>
> > Postgres numbers the rows and fields starting at 0 - your call to get the
> > first row and column would be PQgetvalue(result, 0, 0)
> >
> > Chris
>
> Thanks for your reply, but..
>
> If I have a zero for the field number (last parameter) I get a seg fault
> immediately - gdb shows it to be in PQgetvalue().
>
> If I have a row number of zero (second param) I get the same error as
> below (if the column number is >0 )
>
>
> Simon.
>
>
>
>
> >
> > On Thu, 10 Sep 1998, Simon Drabble wrote:
> >
> > >
> > > I'm executing a (simple) query using libpq, and this is the error I get
> > > from PQgetvalue(result, 1, 1):
> > >
> > > PQgetvalue: There is no field 1 in the query results. The highest
> > > numbered field is 0.
> > >
> > > I get a similar error if I call getlength().
> > >
> > > There _is_ data there - PQprintTuples() prints everything correctly.
> > >
> > >
> > > Can anyone shed any light? PQtrace() doesn't reveal anything useful..
> > >
> > >
> > > Simon.
> > >
> > >
> > > --
> > > ...oooOOOooo...
> > > Simon Drabble mailto:madlather(at)syspac(dot)com
> > > http://fiddletrudge.dyn.ml.org/
> > > KreatAPayj -- ~simon/KreatAPayj/login.html
> > > LizardCam -- LizardCam/LizardCam.html
> > > Linux Knowledge Base -- ~simon/LinuxKB/index.html
> > >
> > >
> > >
> >
>
> --
> ...oooOOOooo...
> Simon Drabble mailto:madlather(at)syspac(dot)com
> http://fiddletrudge.dyn.ml.org/
> KreatAPayj -- ~simon/KreatAPayj/login.html
> LizardCam -- LizardCam/LizardCam.html
> Linux Knowledge Base -- ~simon/LinuxKB/index.html
>
>

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Simon Drabble 1998-09-10 19:44:24 Re: [GENERAL] PQgetvalue weirdness
Previous Message Simon Drabble 1998-09-10 18:42:59 Re: [GENERAL] PQgetvalue weirdness