From: | Vadim Mikheev <vadim(at)krs(dot)ru> |
---|---|
To: | Mark Wright <mwright(at)pro-ns(dot)net> |
Cc: | PostgreSQL Developers List <hackers(at)postgreSQL(dot)org> |
Subject: | Re: [HACKERS] select order by for update |
Date: | 1999-06-10 15:15:19 |
Message-ID: | 375FD687.6D9394AB@krs.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Mark Wright wrote:
>
> |SELECT * FROM test_attendees
> |WHERE print_status = 'R'
> |AND id_number = (select min(id_number) from test_attendees )
^^^
Ops - add "AND print_status = 'R'" here!
> |FOR UPDATE OF test_attendees
> |
> |and run it in loop.
>
> That would only work the first time, since after updating print_status to
> 'C', the record where id_number = (select min(id_number) from
> test_attendees) would no longer have print_status = 'R', so no records would
> match the query.
And this is why I said "run select in loop": if no one row will
be returned (i.e. row returned by subselect is already updated
by concurrent xaction) then re-run select!
Vadim
From | Date | Subject | |
---|---|---|---|
Next Message | A James Lewis | 1999-06-10 15:16:20 | Re: Real Programmers (was: [HACKERS] Priorities for 6.6) |
Previous Message | Thomas Lockhart | 1999-06-10 15:14:43 | Re: [HACKERS] Postgres 6.5 beta2 and beta3 problem |