Hi, all.
Sorry if you have received same mail in pgsql-bugs mailing list.

I wrote C code with libpq using PQsendQuery and lo_open.
In some situation, I cannot open large object.

The situation is following:
1. Open some large object file (using lo_open).
-> succeed
2. Send query asynchronously (using PQsendQuery).
-> succeed
3. Get query result (using PQgetResult).
-> succeed
4. Open another large object file (using pg_lo_open).
-> fail

As a result, second large object lo_open (No.4) returns false.

But if I execute PQgetResult twice, I can open both large objects.
1. Open some large object file (using lo_open).
-> succeed.
2. Send query asynchronously (using PQsendQuery).
-> succeed.
3. Get query result (using PQgetResult).
-> succeed.
4. Get query result (using PQgetResult).
-> Returns NULL.
5. Open another large object file (using pg_lo_open).
-> succeed.

Do I always have to call PQgetResult until this function returns NULL pointer?

----
Yuichi Tanaka (yuichi_tanaka@cybozu.co.jp)

Search Discussions

  • Tom Lane at Feb 27, 2009 at 5:58 am

    Yuichi Tanaka writes:
    Do I always have to call PQgetResult until this function returns NULL pointer?
    Yes. Failing to do that is an erroneous use of PQsendQuery, and it has
    nothing particularly to do with large objects. Once you've done
    PQsendQuery, you *must* repeat PQgetResult until you get NULL before
    any other command can be issued on that connection.

    regards, tom lane
  • Yuichi Tanaka at Feb 27, 2009 at 6:47 am

    you *must* repeat PQgetResult until you get NULL before
    any other command can be issued on that connection.
    Hmm, I understand the behaviour.

    Thank you for your reply!

    Tom Lane wrote:
    Yuichi Tanaka <yuichi_tanaka@cybozu.co.jp> writes:
    Do I always have to call PQgetResult until this function returns NULL pointer?
    Yes. Failing to do that is an erroneous use of PQsendQuery, and it has
    nothing particularly to do with large objects. Once you've done
    PQsendQuery, you *must* repeat PQgetResult until you get NULL before
    any other command can be issued on that connection.

    regards, tom lane

    --
    Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
    To make changes to your subscription:
    http://www.postgresql.org/mailpref/pgsql-novice
    ----
    Yuichi Tanaka (yuichi_tanaka@cybozu.co.jp)

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
categoriespostgresql
postedFeb 27, '09 at 12:42a
activeFeb 27, '09 at 6:47a
posts3
users2
websitepostgresql.org
irc#postgresql

2 users in discussion

Yuichi Tanaka: 2 posts Tom Lane: 1 post

People

Translate

site design / logo © 2022 Grokbase