Subject | Re: Transactions and triggers |
---|---|
Author | lobolo2000 |
Post date | 2006-09-14T08:56:31Z |
<svein.erling.tysvaer@...> wrote:
1- Let's go back to a more primitive case:
CREATE TABLE TABLE1 (
PK BIGINT PRIMARY KEY,
F1 INTEGER NOT NULL UNIQUE);
Start transaction1, insert a new record with F1=1 (do not commit)
Start transaction2, insert a new record with F1=1. (do not commit)
The operation will fail although transaction2 is not supposed to see
the record of transaction1 since transaction1 is not committed).
2- Let's try a different constraint:
CREATE TABLE TABLE1 (
PK BIGINT PRIMARY KEY,
F1 INTEGER NOT NULL CHECK(NOT EXISTS(SELECT PK FROM TABLE1 WHERE
F1=F1)));
Start transaction1, insert a new record with F1=1 (do not commit)
Start transaction2, insert a new record with F1=1. (do not commit)
The operation will succeed.
Commit both transactions. The check constraint will be ignored.
Is this the correct behaviour?
"Dimitry Sibiryakov" <SD@...> wrote:
>duplicates:
> I doubt it. I'd simply add another table and let Firebird handle
1- Let's go back to a more primitive case:
CREATE TABLE TABLE1 (
PK BIGINT PRIMARY KEY,
F1 INTEGER NOT NULL UNIQUE);
Start transaction1, insert a new record with F1=1 (do not commit)
Start transaction2, insert a new record with F1=1. (do not commit)
The operation will fail although transaction2 is not supposed to see
the record of transaction1 since transaction1 is not committed).
2- Let's try a different constraint:
CREATE TABLE TABLE1 (
PK BIGINT PRIMARY KEY,
F1 INTEGER NOT NULL CHECK(NOT EXISTS(SELECT PK FROM TABLE1 WHERE
F1=F1)));
Start transaction1, insert a new record with F1=1 (do not commit)
Start transaction2, insert a new record with F1=1. (do not commit)
The operation will succeed.
Commit both transactions. The check constraint will be ignored.
Is this the correct behaviour?
"Dimitry Sibiryakov" <SD@...> wrote:
> These fields' values will be unique if they are gotten from oneSure.
> generator.