From: | Philip Warner <pjw(at)rhyme(dot)com(dot)au> |
---|---|
To: | PGSQL Hackers<pgsql-hackers(at)postgresql(dot)org> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
Subject: | Bug in constraings (from GENERAL) |
Date: | 2000-09-30 01:24:42 |
Message-ID: | 3.0.5.32.20000930112442.02341e20@mail.rhyme.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 1
zzz=# insert into tab1 values(-10);
INSERT 142381 1
zzz=# select tot_of_tab1();
tot_of_tab1
-------------
-9
(1 row)
zzz=# insert into 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 |/
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2000-09-30 02:16:44 | Re: uniqueness not always correct |
Previous Message | Peter Eisentraut | 2000-09-30 00:19:26 | Unruly rules |