Index: openacs-4/packages/acs-core-docs/www/eng-standards-constraint-naming.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/eng-standards-constraint-naming.adp,v diff -u -r1.1.2.5 -r1.1.2.6 --- openacs-4/packages/acs-core-docs/www/eng-standards-constraint-naming.adp 21 Jun 2016 07:44:36 -0000 1.1.2.5 +++ openacs-4/packages/acs-core-docs/www/eng-standards-constraint-naming.adp 23 Jun 2016 08:32:45 -0000 1.1.2.6 @@ -57,11 +57,11 @@

Format of constraint name

<table name>_<column_name>_<constraint -abbreviation>

In reality, this won't be possible because of the character +abbreviation>

In reality, this won't be possible because of the character limitation on names inside oracle. When the name is too long, we will follow these two steps in order:

    -
  1. Abbreviate the table name with the table's initials (e.g. users --> u and users_contact -> uc).

  2. Truncate the column name until it fits.

  3. +
  4. Abbreviate the table name with the table's initials (e.g. +users -> u and users_contact -> uc).

  5. Truncate the column name until it fits.

If the constraint name is still too long, you should consider rewriting your entire data model :)

Notes:

-Why it's good to name +Why it's good to name primary keys

Naming primary keys might not have any obvious advantages. -However, here's an example where naming the primary key really +However, here's an example where naming the primary key really helps (and this is by no means a rare case!

 SQL> set autotrace traceonly explain;
 
@@ -114,19 +114,21 @@
    2    1     TABLE ACCESS (FULL) OF 'CONSTRAINT_NAMING_EXAMPLE'
    3    1     INDEX (UNIQUE SCAN) OF 'EXAMPLE_TOPICS_TOPIC_ID_PK' (UNI
           QUE)
-

Isn't it nice to see "EXAMPLE_TOPICS_TOPIC_ID_PK" in the trace -and know exactly which table oracle is using at each step?

+

Isn't it nice to see "EXAMPLE_TOPICS_TOPIC_ID_PK" +in the trace and know exactly which table oracle is using at each +step?

Naming not null constraints is optional...

People disagree on whether or not we should be naming not null constraints. So, if you want to name them, please do so and follow the above naming standard. But, naming not null constraints is not -a requirement.

About Naming the not null constraints

Though naming "not null" constraints doesn't help immeditately -in error debugging (e.g. the error will say something like "Cannot -insert null value into column"), we recommend naming not null -constraints to be consistent in our naming of all constraints.

($‌Id: constraint-naming.xml,v 1.6 2006/07/17 -05:38:37 torbenb Exp $)
+a requirement.

About Naming the not null constraints

Though naming "not null" constraints doesn't help +immeditately in error debugging (e.g. the error will say something +like "Cannot insert null value into column"), we +recommend naming not null constraints to be consistent in our +naming of all constraints.

($‌Id: eng-standards-constraint-naming.html,v +1.48.2.10 2016/06/21 07:44:36 gustafn Exp $)