Bug in constraings (from GENERAL) - Mailing list pgsql-hackers

From Philip Warner
Subject Bug in constraings (from GENERAL)
Date
Msg-id 3.0.5.32.20000930112442.02341e20@mail.rhyme.com.au
Whole thread Raw
List pgsql-hackers
This seems to be a bug:
Create Table tab1 (f1 integer);Create Function tot_of_tab1() returns integer      as 'select cast(sum(f1) as int4) from
tab1'language 'sql';Alter Table tab1 add check(tot_of_tab1() > 0);zzz=# insert into tab1 values(1);INSERT 142380 1zzz=#
insertinto tab1 values(-10);INSERT 142381 1zzz=# select tot_of_tab1(); tot_of_tab1-------------          -9(1 row)zzz=#
insertinto tab1 values(-12);ERROR:  ExecAppend: rejected due to CHECK constraint $1
 
The constraint should have failed on the second insert. Maybe the
constraint is evaluate before the insert? 


----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.B.N. 75 008 659 498)          |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 0500 83 82 82         |                 ___________ |
Http://www.rhyme.com.au          |                /           \|                                |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Unruly rules
Next
From: Bruce Momjian
Date:
Subject: I am back