Subject RE: [firebird-support] Foreign key reference target does not exist. [FB 2.5 beta 2]
Author Alan McDonald
> >> I tried to create a foreign key but I always get this error:
> >>
> >> violation of FOREIGN KEY constraint "".
> >> violation of FOREIGN KEY constraint "FK_RES_TREEVIEW_1" on table
> >> "RES_TREEVIEW".
> >> Foreign key reference target does not exist.
> >>
> >
> > this usually means you have not committed the table creation BEFORE
> you
> > attempt to craete the foreign key. i.e. "Foreign key reference target
> does
> > not exist."
>
> Sorry, but this is wrong.
>
> a) you can issue as many DDL statements in the same transaction as you
> need
> b) what you should not do - is to issue DML after DDL in the same
> transaction
> (not this case)
> c) error means exactly what message said - no master record with key
> value
> corresponding to the some child record(s)
>
> Regards,
> Vlad

the the op never mentioned adding any records - i.e. both tables are empty.
So the FK should work - no?
Alan