# Unwanted default value in FK

**URL:** <https://forums.toadworld.com/t/unwanted-default-value-in-fk/2642>\
**Category:** Toad Data Modeler\
**Created:** [February 15, 2012, 8:09am UTC](https://forums.toadworld.com/t/unwanted-default-value-in-fk/2642 "2012-02-15T08:09:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michal.K](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@Michal.K](https://forums.toadworld.com/u/Michal.K)\
**Post date:** [February 15, 2012, 8:09am UTC](https://forums.toadworld.com/t/unwanted-default-value-in-fk/2642/1 "2012-02-15T08:09:28Z")

</div>

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’

---

<div class="post-metadata">

**Author:** ![Vaclav\_Frolik](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/vaclav_frolik/32/12_2.png) [@Vaclav\_Frolik](https://forums.toadworld.com/u/Vaclav_Frolik)\
**Post date:** [February 21, 2012, 4:17am UTC](https://forums.toadworld.com/t/unwanted-default-value-in-fk/2642/2 "2012-02-21T04:17:44Z")

</div>

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

 ![obligatory.png](https://global.discourse-cdn.com/quest/original/2X/8/811005f38dd78cc65f0969f40a89405b8511e917.png)

---

<div class="post-metadata">

**Author:** ![Michal.K](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@Michal.K](https://forums.toadworld.com/u/Michal.K)\
**Post date:** [February 21, 2012, 4:47am UTC](https://forums.toadworld.com/t/unwanted-default-value-in-fk/2642/3 "2012-02-21T04:47:39Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Vaclav\_Frolik](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/vaclav_frolik/32/12_2.png) [@Vaclav\_Frolik](https://forums.toadworld.com/u/Vaclav_Frolik)\
**Post date:** [February 21, 2012, 6:17am UTC](https://forums.toadworld.com/t/unwanted-default-value-in-fk/2642/4 "2012-02-21T06:17:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michal.K](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@Michal.K](https://forums.toadworld.com/u/Michal.K)\
**Post date:** [February 21, 2012, 11:40am UTC](https://forums.toadworld.com/t/unwanted-default-value-in-fk/2642/5 "2012-02-21T11:40:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sebastien.frade2013](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sebastien.frade2013](https://forums.toadworld.com/u/sebastien.frade2013)\
**Post date:** [February 15, 2013, 3:43am UTC](https://forums.toadworld.com/t/unwanted-default-value-in-fk/2642/6 "2013-02-15T03:43:12Z")

</div>

Hi,

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

I’m using TDM 4.3.3.6.

Cheers,  
Sebastien

---

<div class="post-metadata">

**Author:** ![Vaclav\_Frolik](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/vaclav_frolik/32/12_2.png) [@Vaclav\_Frolik](https://forums.toadworld.com/u/Vaclav_Frolik)\
**Post date:** [February 15, 2013, 9:41am UTC](https://forums.toadworld.com/t/unwanted-default-value-in-fk/2642/7 "2013-02-15T09:41:08Z")

</div>

Hi Sebastien,

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

Regards,

Vaclav

 ![propagation.png](https://global.discourse-cdn.com/quest/original/2X/e/e08e6e85b6128133ed5818eb944a1ac8823aabc3.png)

---

<div class="post-metadata">

**Author:** ![sebastien.frade2013](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sebastien.frade2013](https://forums.toadworld.com/u/sebastien.frade2013)\
**Post date:** [February 18, 2013, 5:13am UTC](https://forums.toadworld.com/t/unwanted-default-value-in-fk/2642/8 "2013-02-18T05:13:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Vaclav\_Frolik](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/vaclav_frolik/32/12_2.png) [@Vaclav\_Frolik](https://forums.toadworld.com/u/Vaclav_Frolik)\
**Post date:** [February 19, 2013, 3:40am UTC](https://forums.toadworld.com/t/unwanted-default-value-in-fk/2642/9 "2013-02-19T03:40:05Z")

</div>

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
