Re: problem with notify/listen - Mailing list pgsql-hackers

From Tom Lane
Subject Re: problem with notify/listen
Date
Msg-id 24756.1011108351@sss.pgh.pa.us
Whole thread Raw
In response to problem with notify/listen  (Barry Lind <barry@xythos.com>)
List pgsql-hackers
Barry Lind <barry@xythos.com> writes:
> If I run jdbc with setAutoCommit=true then notifications work as 
> expected, however if I run with setAutoCommit=false then notifications 
> are not being sent from the backend to the client.

You are aware that notifications are only sent at transaction commit,
right?

> The only thing that is unusual about this is that the 
> "commit;begin;" command string is sent to the server as a single query 
> to be processed.

Hm.  The response to this string (assuming that there's a notify
waiting) would look like
N foo            (NOTIFY)C COMMIT        (commit command complete)C BEGIN            (begin command complete)Z
 (ready for new query)
 

(that's from memory, so forgive any minor inaccuracy).  I speculate that
either JDBC or your test code is dropping the NOTIFY in this situation.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: 7.1 vs. 7.2 on AIX 5L
Next
From: Tom Lane
Date:
Subject: Re: FATAL 1: Relation 'pg_shadow' does not exist