Do not insert a record into a table with a foreign key.

Database
DTV
Fan

Do not insert a record into a table with a foreign key.

We get error when we insert record into the table with foreign key on column  «KEY»:

create table t1

("KEY" integer not null primary key);

create table t1_1

("VERSION" integer not null primary key,

"KEY" integer not null,

constraint C_FK1 foreign key("KEY") references WITH CHECK OPTION t1("KEY")

);

insert into t1("KEY") values (1);

insert into t1_1("VERSION","KEY") values (1,1);

When we try to insert a record into the table t1_1  we got error:

Failed [3610: HY000] Internal error: Please do not resubmit the last request. SubCode, CrashCode: 0, 3701

What is wrong with such foreign keys? It works for Oracle and MSSQL without errors.

If we rename both columns to “KEY_” or remove “WITH CHECK OPTION” the error disappears.

We need foreign keys on such columns for compatibility and we need  “WITH CHECK OPTION” to ensure referential integrity.

How can we fix error on Teradata?

3 REPLIES
Junior Supporter

Re: Do not insert a record into a table with a foreign key.

>>"How can we fix error on Teradata?"

Not using reserved words as column names?

Cheers.

Carlos.

Teradata Employee

Re: Do not insert a record into a table with a foreign key.

Any time you get a 3610 error, it should be reported as a Teradata incident. It represents a fault in the database engine that should be identified and repaired.

DTV
Fan

Re: Do not insert a record into a table with a foreign key.

Can we use quoted keywords as field names for foreign keys? Is it allowed by SQL specification supported by Teradata RBDMS?