pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Brian Curnow <bcurnow@sonnet.com>
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] perl5 Should consumeInput obliterate unretrieved Notifys?
Date: Thu, 29 Jul 1999 21:19:22 -0400
Message-ID: <9462.933297562@sss.pgh.pa.us> (raw)
In-Reply-To: <37A0E659.5F423AA8@sonnet.com>

Brian Curnow <bcurnow@sonnet.com> writes:
> What I am seeing is that if a Notify arrives between the SELECT and
> UPDATE, the exec(UPDATE) call consumes the notify, and when the next
> consumeInput is eventually called, the notify disappears.

"Disappears"?  It certainly should not disappear; the event should be
sitting patiently in the list of notify events not yet returned by
PQnotifies().

> The docs for libpq state that you should call notifies() after each
> PQexec or PQgetResult,

What they mean is that each such call might possibly cause events to
become available from PQnotifies().  PQnotifies() itself just pulls
notify records from a queue of pending notify records; it does not try
to consume input from the backend.  Those other routines consume input,
and append any notify messages they come across to the queue for
PQnotifies().

You don't have to call PQnotifies() oftener than it makes sense for your
application logic to try to process notify events...

Perhaps you are confusing the existence of a select() read-ready
condition with the availability of a NOTIFY message.  They're not
the same thing.  consumeInput will clear the select() condition,
but that may or may not result in the availability of a NOTIFY.

You might want to think about checking PQnotifies immediately *before*
blocking at select(), rather than after...

			regards, tom lane



view thread (2+ messages)

Message-ID: <9462.933297562@sss.pgh.pa.us>
Permalink:  ../9462.933297562@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9462.933297562@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bcurnow@sonnet.com
  Subject: Re: [INTERFACES] perl5 Should consumeInput obliterate unretrieved Notifys?
  In-Reply-To: <9462.933297562@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox