SELECT FOR UPDATE locks whole table - Mailing list pgsql-sql

From D'Arcy J.M. Cain
Subject SELECT FOR UPDATE locks whole table
Date
Msg-id 20021206190303.98BD31BA6@druid.net
Whole thread Raw
Responses Re: SELECT FOR UPDATE locks whole table  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: SELECT FOR UPDATE locks whole table  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
We have the following query:

SELECT certificate_id   INTO TEMP TABLE x_certs   FROM certificate   WHERE cert_status = 0 AND       certificate_id
BETWEEN1111 AND 2222 AND       client_id IN (1, 2, 3)   ORDER BY certificate_id   FOR UPDATE;
 

Is there any reason that this query should lock the entire certificate table? Is there something strange because of the
INclause or because it is going 
 
into a temporary table?  This is a production server running 7.2.2 so perhaps 
it is fixed in 7.3.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.


pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: order by a "select as" determined by case statement
Next
From: Bruce Momjian
Date:
Subject: Re: SELECT FOR UPDATE locks whole table