Strange pg_oid problem.

From: Andrew Hill <andru(at)treshna(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Strange pg_oid problem.
Date: 2001-12-18 01:58:49
Message-ID: 1008640729.21088.6.camel@nikita
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello.

I'm using debian on i386 with postgresql 7.1.3.

I'm writing an interface libary to postgresql which uses libpq, and
I've stumbled across a weird problem and i'm having problems tracking
down.

Oh and sorry about bad code formating, evolution an't giving me as much
room as i want.

main()
{
gint err;
PGresult *res;
res = PQexec(globaldbconn->conn, "SELECT *,oid FROM programme WHERE
id='2131'");

err = PQresultStatus(res);
if (err == PGRES_BAD_RESPONSE || err == PGRES_NONFATAL_ERROR || err ==
PGRES_FATAL_ERROR)
{
printf("Result failed with %s\n", PQresultErrorMessage(res));
}
printf("%s returned for oid",PQgetvalue(res, 0, 16));
}

oid is at position 16 in the result set, what i'm basically getting is
the oid for the record where id=2131.
The returned value is 3249697. If I run the sql statement into pgsql i
get:

SELECT *,oid FROM programme WHERE id='2131';
id | programmegroupid | name | director | amount
| enrollimit | waitinglistlimit | startdate | enddate |
imembershiplength | membershiplengthtype | concession | programmetype |
history | quickadd | oneoff | oid
------+------------------+-----------------------+-------------+--------+------------+------------------+------------+------------+-------------------+----------------------+------------+---------------+---------+----------+--------+---------
2131 | 9 | L The Dream Team 9/99 | Ariana Sour | 0
| 0 | 0 | 1999-09-20 | 1999-11-01
| 0 | 1 | 0 | 2
| f | f | f | 3249697
(1 row)
Which seems fine,

Now this is all what behave should be, but if i insert the exact same
code into my libary at a low level point, ie everytime i do a PQexec, i
get the result 2729675. Everything else seems to work fine execpt this
which is why it took me ages to pick up. Would having serveral
resultsets open at one time effect the oid values?. This could be
something in my libary screwing up, but i dont know. And if it is a bug
it could be hard to replicate, I'll keep working on it to see if i can
find something more definate that always causes it.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Markus Bertheau 2001-12-18 09:19:22 Re: stuck spinlock. Aborting. What does this mean?
Previous Message Hiroshi Inoue 2001-12-17 23:54:15 Re: PostGIS/ PostGreSQL ODBC problem