Violations not working!
Posted in 2009
It is my understanding that if you start violations on a table create a
foreign key constraint in disabled mode then alter it to filtering that rows
that violate the constraint to the violations tables and if you have
specified the WITHOUT ERROR clause that should happen silently. However, it
does not work. Witness:
>
> CREATE TABLE "informix".sometable (
> serial_key SERIAL(5806509) NOT NULL,
> other_value INTEGER NOT NULL
> ) LOCK MODE ROW;
Table created.
> CREATE TABLE dependent_table (
> serial_key INTEGER,> yet_another_value INTEGER
> );
Table created.
>
> insert into sometable values (13, 9876);
1 row(s) inserted.
> insert into dependent_table values (12, 1234);
1 row(s) inserted.
> insert into dependent_table values (13, 4321);
1 row(s) inserted.
>
> CREATE UNIQUE INDEX sometable_pk ON sometable (> serial_key ASC
> );
Index created.
>
> START VIOLATIONS table FOR dependent_table;
Table started.
> CREATE INDEX dependent_table_fk1 on dependent_table ( serial_key ASC);
Index created.
> ALTER TABLE sometable ADD CONSTRAINT PRIMARY KEY (serial_key) CONSTRAINTsometable_pk;
Table altered.
> ALTER TABLE dependent_table ADD CONSTRAINT foreign key ( serial_key )
references sometable( serial_key )CONSTRAINT dependent_table_fk1 disabled;
SET CONSTRAINTS dependent_table_fk1 FILTERING WITHOUT ERROR;
971: Integrity violations detected.
Error in line 1Near character position 58
I use this paradigm in myimport to insure relational integrity of the
imported database that was exported using myexport without locking the
database. It's NEVER worked and I'm just getting around to trying to figure
out why. Any ideas? Even "Open a case" will help by getting me off my duff
to do that. ;-)
Art S. Kagel
Oninit (www.oninit.com)
IIUG Board of Directors (art@iiug.org)
Disclaimer: Please keep in mind that my own opinions are my own opinions and
do not reflect on my employer, Oninit, the IIUG, nor any other organization
with which I am associated either explicitly or implicitly. Neither do
those opinions reflect those of other individuals affiliated with any entity
with which I am affiliated nor those of the entities themselves.
--001517402a427d827204742f8ce0