Hi Hackers,

I have a strange problem, or maybe it's not a strange problem but just
something wrong with my understanding i have SIP router which works with
postgresql using libpq, somewhere in the code it inserts a row in the
database and then when the insert is finished it invokes another module
which tries to read it , however sometimes the read operation doesn't find
the row which was just inserted, this happens if there are large number of
insert / read cycles like this are going on , the code which inserts the row
uses PQsendQuery to insert and waits for PQgetResult to return null before
the read module is invoked, the module which reads the row , reads it over a
new connection. My question is if PQgetResult returns null is this a good
enough guarantee that a subsequent connection (even in next millisecond)
should be able to read that row??

Thanks for making me wiser

/Usama

Search Discussions

  • Merlin Moncure at Oct 7, 2011 at 4:34 pm

    On Fri, Oct 7, 2011 at 11:17 AM, Usama Dar wrote:
    Hi Hackers,
    I have a strange problem, or maybe it's not a strange problem but just
    something wrong with my understanding i have SIP router which works with
    postgresql using libpq, somewhere in the code it inserts a row in the
    database and then when the insert is finished it invokes another module
    which tries to read it , however sometimes the read operation doesn't find
    the row which was just inserted, this happens if there are large number of
    insert / read cycles like this are going on , the code which inserts the row
    uses PQsendQuery to insert and waits for PQgetResult to return null before
    the read module is invoked, the module which reads the row , reads it over a
    new connection. My question is if PQgetResult returns null is this  a good
    enough guarantee that a subsequent connection (even in next millisecond)
    should be able to read that row??
    Thanks for making me wiser
    /Usama
    yeah -- Iron clad rule is that if you get the result and are able to
    see that your query has been successfully transacted, so should
    everyone else. Are you sure your query didn't error out? Are you
    also sure you didn't open a transaction and not close it? our problem
    is most likely on your end.

    merlin

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedOct 7, '11 at 4:17p
activeOct 7, '11 at 4:34p
posts2
users2
websitepostgresql.org...
irc#postgresql

2 users in discussion

Usama Dar: 1 post Merlin Moncure: 1 post

People

Translate

site design / logo © 2022 Grokbase