Unwanted default value in FK

I know that the behaviour may be changed by using setting ‘Attribute properties propagation’. But I found situation when setting it to ‘all PKs’ may be unwanted or even dengerous.

When PK is created as serial, and then get back to the TDM using RE, default value of PK will be set to nextval(some_sequence). When creating FK from this PK, nextval command is set for FK.

At this stage I don’t know cases in whitch this feature might be usefull. Even in 1:1 relationships, ussualy (if not always) one table is considered to be parent. Setting some default values (especialy using some default functions, not onlu nextval) in childs may be dengerous.
To me it should never happen - but I don’t know all points of view.

I cannot confirm how is ‘Attribute properties propagation’ set by default. I found it enabled. If it is enabled by default, I suggest to turn it off.

PS. What situations are affected if ‘Attribute properties propagation’ is set to ‘Only obliggatory PK properties’

Hi Michal,

Toad Data Modeler works with column items, that's why in case you specify default value in parent, the value is either passed to child table or not passed at all. To our regret, we are not able to parse what you define as default value, that's why we do not recognize nexval() and other similar default values specifications.

If you wish to know what items belong to "Only Obligatory PK Properties" in TDM, open Reference and in section PERAttribute see properties that have Copy to FK obligatory attribute. (Properties that have Copy to FK attribute migrate from parent to child in case settings are set to All PK Properties.)

See attached screenshot.

And yes, sometimes it is better to turn this option off.

Regards,

Vaclav

Thank you for answer.
I’m curious in what situations (from database modelling point of view) child key (foreign key) should be filled by default value. Can you list some situations in db modelling which must be covered by this feature?

Hi Michal

It can be useful in case you model database for MySQL and decide to use table type that doesn’t support relations, or if you decide to generate SQL code without relations for any of the target databases. In such cases you may want to keep your model with relations to see references etc. but in physically existing database you have to focus on performance.

Have a great day,

Vaclav

If I wouldn’t want or cannot use relations, I’m sure I will not use default value for FK other than NULL (or NOT NULL at all). Allowing generating FK value by child table is quite dangerous IMO.

However thank you for answer. Good, that this feature may be disabled.

Hi,

I’m newbie with TDM.
Where do you disable the “attribute properties propagation”?

I’m using TDM 4.3.3.6.

Cheers,
Sebastien

Hi Sebastien,

see attached screen shot. Quick question: Why do you want to disable it?

Regards,

Vaclav

The primary key has as default SYS_GUID(). This allows Oracle to generate a Globally Unique IDentifier. But I do not want this default being migrated to the foreign keys.

I maybe wrongly used TDM.
So what would be a better way of working?

Sebastien

Hi,

see the screen shot above. Set the value to Only Obligatory PK Properties and the defaul value will not migrate to child attribute automatically.

Regards,

Vaclav