New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check constraints don't operate in system context [CORE470] #816
Comments
Commented by: Alice F. Bird (firebirds) Date: 2004-06-15 18:37 Appologies for using the term 'dirty read'! I mean 'operate in |
Modified by: Alice F. Bird (firebirds)description: SFID: 973159# Check constraints only see committed data from other create table T (pk integer not null primary key, i integer ALTER TABLE T ADD CONSTRAINT Unique_I_T CHECK (snapshot transactions) Trans 2: Trans 1: Start new trans: Example is simplistic, but more of a problem when => SFID: 973159# Check constraints only see committed data from other create table T (pk integer not null primary key, i integer ALTER TABLE T ADD CONSTRAINT Unique_I_T CHECK (snapshot transactions) Trans 2: Trans 1: Start new trans: Example is simplistic, but more of a problem when |
Modified by: @pcisarWorkflow: jira [ 10494 ] => Firebird [ 14786 ] |
Commented by: arni (arni) >>CHECK (not exists (select pk from T where new.i = T.i and pk <> http://new.pk) This is very, very bad practice. |
Submitted by: johnsparrowuk (johnsparrowuk)
SFID: 973159#
Submitted By: johnsparrowuk
Check constraints only see committed data from other
transactions, when they should dirty-read to be
consistent with index behaviour (operate in system
transaction context?).
For example:
create table T (pk integer not null primary key, i integer
not null);
ALTER TABLE T ADD CONSTRAINT Unique_I_T CHECK
(not exists (select pk from T where new.i = T.i and pk
<> http://new.pk)
(snapshot transactions)
Trans 1:
insert into T values (1,1); WORKS FINE
Trans 2:
insert into T values (2,2); WORKS FINE
insert into T values (3,2); CHECK VIOL, COOL!
insert into T values (3,1); WORKS, OH DEAR!
commit
Trans 1:
commit
Start new trans:
select * from T
1,1
2,2
3,1 (violation of check constraint)
Example is simplistic, but more of a problem when
checking for overlapping periods (for example) which
can't have unique indexes applied.
The text was updated successfully, but these errors were encountered: