BUG #3479: contraint exclusion and locks - Mailing list pgsql-bugs

From Tiago Jacobs
Subject BUG #3479: contraint exclusion and locks
Date
Msg-id 200707231324.l6NDO8Nm010057@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #3479: contraint exclusion and locks  (Gregory Stark <stark@enterprisedb.com>)
Re: BUG #3479: contraint exclusion and locks  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      3479
Logged by:          Tiago Jacobs
Email address:      tiago@mdtestudio.com.br
PostgreSQL version: 8.2.4
Operating system:   Linux 2.6.21.5
Description:        contraint exclusion and locks
Details:

Hi People!

Connection #1
create table tab (dt_tab date);
create table tab_2 () inherits (tab);
create table tab_1 () inherits (tab);
alter table tab_2 add constraint constraint_x check (dt_tab >= '20070701');
alter table tab_2 add constraint constraint_y check (dt_tab <= '20070731');
alter table tab_1 add constraint constraint_x check (dt_tab >= '20070601');
alter table tab_1 add constraint constraint_y check (dt_tab <= '20070630');

explain select * from tab where dt_tab = '20070705';

>"Result  (cost=0.00..73.50 rows=22 width=4)"
>"  ->  Append  (cost=0.00..73.50 rows=22 width=4)"
>"        ->  Seq Scan on tab  (cost=0.00..36.75 rows=11 width=4)"
>"              Filter: (dt_tab = '2007-07-05'::date)"
>"        ->  Seq Scan on tab_2 tab  (cost=0.00..36.75 rows=11 width=4)"
>"              Filter: (dt_tab = '2007-07-05'::date)"


Connection #2
begin;
lock table tab_1 in exclusive mode;
TrUNCATE TABLE tab_1;

Connection #1
explain select * from tab where dt_tab = '20070705'

oh-ow... It waits while the table (That is not used) is locked.

Even that the final plan dont use tab_2007_07, it wait for unlock of table
for make the plan.

So, if I`m running a VACUUM on specific table, all the querys on the
"master" table don't work.

Best Regards,
Tiago

pgsql-bugs by date:

Previous
From: "Walter Roeland"
Date:
Subject: BUG #3476: description of root.crt/crl in documentation
Next
From: "Andrei Badea"
Date:
Subject: BUG #3480: JDBC driver: getIndexInfo() returns quotes around quoted column names