| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | "Daniel Caune" <daniel(dot)caune(at)ubisoft(dot)com> |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: Strang behaviour SELECT ... LIMIT n FOR UPDATE |
| Date: | 2007-11-28 04:46:29 |
| Message-ID: | 18953.1196225189@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
"Daniel Caune" <daniel(dot)caune(at)ubisoft(dot)com> writes:
> I'm facing a strange behaviour with a statement SELECT ... LIMIT n FOR
> UPDATE in PostgreSQL 8.1. The number of rows returned is actually (n -
> 1). I'm trying to find whether this is an identified issue with
> PostgreSQL 8.1 that might have been fixed in a later version such as
> 8.2; I don't have any problem in moving to a later version if needed.
There's no known issue specifically of that form (and a quick test of
8.1 doesn't reproduce any such behavior). However, it is known and
documented that LIMIT and FOR UPDATE behave rather oddly together:
the LIMIT is applied first, which means that if FOR UPDATE rejects
any rows as being no longer up-to-date, you get fewer than the expected
number of rows out. You did not mention any concurrent activity in
your example, but I'm betting there was some ...
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2007-11-28 04:50:51 | Re: Strang behaviour SELECT ... LIMIT n FOR UPDATE |
| Previous Message | Michael Glaesemann | 2007-11-28 02:47:36 | Re: NULLIF problem |