Links

Ruslan Zasukhin ruslan_zasukhin at valentina-db.com
Fri Aug 21 07:46:12 CDT 2015


On 8/21/15, 4:39 AM, "Mark Schonewille" <m.schonewille at economy-x-talk.com>
wrote:

Frankly saying not clear at all.

1)  Why you think you have BinaryLink, if error says about FOREING KEY?


> In addition to my previous e-mail, a few more questions.
> 
> I have two tables. table1 and table2. Table1 is a very big table and
> table2 is a very small table, considering the number of fields. Both
> tables contain field key1. In table1, key1 is set as the primary key.
> Table2 doesn't have a primary key, but key1 could be set as its primary
> key, although I have another candidate for the primary key.
> 
> The two tables are linked as follows:
> 
> SET PROPERTY "last_related" OF TABLE "table2" TO 'table1:
> Link_table1_table2 (M:1)';

This is NOT a link, and I do not see what is this.
Some PROPERTY of Table table2.

Where from this command?
Why you think this is about link?

 
> I now try to insert data into the small table2 with a query like
> 
> INSERT INTO table2 (field1, field2, key1, field4)
>    VALUES ('data 1','data 2','0001','data 4')
> 
> Table1 already has record with 0001 in field key1, but table2 doesn't
> have such a record. If I run my query, I always get error 0x23502,
> ERR_CONSTRAINT_FOREIGN_KEY_VIOLATION.
 
> What is the explanation for this error?

You try INSERT record, but some FOREIGN KEY constraint prevent this.

By idea, this can happens, if you INSERT some key-value, which not exists in
parent table. But you say table1 have it.


> Did I set the property incorrectly, e.g. should I use 1:M instead of
> M:1? If so, why?

PROPERTY is not a link!
 

> Since no other database system uses this type of links (according to the
> docs), is it really a good idea to use this type of links? Should I just
> not link table2? What kind of queries does the link make possible, which
> otherwise wouldn't be possible?

Mark, again, you talk her about normal Foreign Keys as I see.
Every RDBMS have them.
The same rules.


Please check carefully your schema.
May be send us small diagram from Vstudio with these 2 tables.

Because not clear.



-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list