Search Postgresql Archives

Re: Cursor not getting all rows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Joseph Shraibman <jks@xxxxxxxxxxxxxxx> writes:
> I do this:

> BEGIN;
> SELECT count(*) FROM u, d WHERE u.id = d.id AND ... ;
> DECLARE cname CURSOR FOR SELECT u.field, d.field FROM u, d WHERE u.id = 
> d.id AND ... ;

> At the end of the fetching if the number of fetched does not equal the 
> number from the SELECT count(*) I print out a warning message.  It 
> happens every once in a while.  Today it happened four times.

> How is this possible?  Because they are in the same transaction the 
> count and the cursor should see the exact same data, right?

Not unless you are using SERIALIZABLE mode --- otherwise the cursor will
see whatever changes were committed during execution of the first SELECT.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@xxxxxxxxxxxxxx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux