Sven K�hler wrote:
>
> > what did i do wrong?
> > what might cause this error?
> >
> > it's a simple create table command.
> >
> > i'm still searching for a small example to reproduce this, but it's
> > harder than i thought.
>
> i couldn't find any simpler test-case.
> i cannot imagine, why this should fail, but the last create table
> command fails (with the error in the subject):
>
> CREATE TABLE base_landesverb�nde (
> id_lvb INT DEFAULT SERIAL,
> PRIMARY KEY (id_lvb))
> //
> CREATE TABLE base_bundesl�nder (
> id_bundesland INT DEFAULT SERIAL,
> PRIMARY KEY (id_bundesland))
> //
> CREATE TABLE data_benutzer (
> id_benutzer INT DEFAULT SERIAL,
> id_lvb INT ,
> FOREIGN KEY id_lvb(id_lvb) REFERENCES base_landesverb�nde(id_lvb) ON
> DELETE CASCADE,
> PRIMARY KEY (id_benutzer))
> //
> CREATE TABLE pa_data_artikel (
> id_artikel INT DEFAULT SERIAL,
> id_lvb INT ,
> id_bundesland INT ,
> FOREIGN KEY id_lvb(id_lvb) REFERENCES base_landesverb�nde(id_lvb) ON
> DELETE CASCADE,
> FOREIGN KEY id_bundesland(id_bundesland) REFERENCES
> base_bundesl�nder(id_bundesland) ON DELETE CASCADE,
> PRIMARY KEY (id_artikel))
> //
> CREATE TABLE pa_data_artikel_hist (
> id_hist INT DEFAULT SERIAL,
> id_artikel INT NOT NULL,
> id_benutzer INT ,
> FOREIGN KEY id_artikel(id_artikel) REFERENCES
> pa_data_artikel(id_artikel) ON DELETE CASCADE,
> FOREIGN KEY id_benutzer(id_benutzer) REFERENCES
> data_benutzer(id_benutzer) ON DELETE SET NULL,
> PRIMARY KEY (id_hist))
>
> What have i dont wrong?
> Thx
> Sven
1. column id_benutzer in table data_benutzer is the primary key
2. primary key columns (as written in reference manual, chapter
Key definition):
A key column must not identify a column of the data type LONG and is always a NOT NULL
column.
3. as written in reference manual, chapter DELETE rule:
ON DELETE SET NULL: if a row in the referenced table is deleted, a NULL value is
assigned to each referencing column of every matching row.
None of these referencing tables may be a NOT NULL column.
--> DELETE SET NULL on the key column id_benutzer in table data_benutzer is not
possible because it is not possible on any primary key column.
Elke
SAP Labs Berlin
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general