Toad World® Forums

Primary Keys on Tables


#1

WHen I create a primary key on a table, it automatically marks the column as not null. It does not, however, mark it as unique. If I click on Unique, then it creates a new key column, with a unique index constraint.

This should either check and grey out Unique, just like it does for Not Null, or not create a new key. I am building against SQL Server.


#2

Hi,

primary key marks column as not null only in case the option Allow Null Attributes in keys is disabled. Otherwise it gets enabled and you can manually define primary key that is nullable. I don’t feel this is frequently used, but it is possible. Databases allow this to be used.

Re unique items. In the latest beta version we added text New AK after the combo box to make it more obvious what happens in TDM. By default, primary keys are unique and the only moment when you should need to mark the Unique checkbox manually is when you need to create new alternate key together with primary key. This also might be used.

I believe the current behavior is OK.

Regards,

Vaclav
nullkeys1.png


#3

Hi,

primary key marks column as not null only in case the option Allow Null Attributes in keys is disabled. Otherwise it gets enabled and you can manually define primary key that is nullable. I don’t feel this is frequently used, but it is possible. Databases allow this to be used.

Re unique items. In the latest beta version we added text New AK after the combo box to make it more obvious what happens in TDM. By default, primary keys are unique and the only moment when you should need to mark the Unique checkbox manually is when you need to create new alternate key together with primary key. This also might be used.

I believe the current behavior is OK.

Regards,

Vaclav


#4

All right. The text will help to make the behaviour more clear.

As a side note, I am happy with the default behaviour of Not Null being checked with the creation of a Primary Key. Sorry if my description of the issue made it seem otherwise.