Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: naming conventions for constraints
Mike Sherrill wrote:
> On Wed, 30 Apr 2003 14:00:41 +0200, "Sönke Petersen"
> <sk.petersen_at_gmx.de> wrote:
>
> >after studying some documents on naming conventions the main recommendations
> >for constraints seem to be that constraints should be named as the table it
> >is applied to, followed by a suffix which identifies its type.
> >
> >table name: systems
> >
> >possible constraint names could be:
> >
> >systems_pk --> primary key constraint
> >systems_fk --> first foreign key constraint
> >systems_fk2 --> second foreign key constraint
> >
> >A second approach could be to apply the column name as well:
> >
> >systems_id_pk --> primary key constraint
> >systems_hostname_fk --> foreign key constraint
>
> I try to name constraints according to their underlying logic. Their
> full name consists of the table name, column name, and logical
> purpose. I use a table of transformations to manage abbreviations of
> all three of these. So the full name of a constraint might be
>
> parties_fullname_required
>
> and that might abbreviate to
>
> p_fullname_reqd
>
> --
> Mike Sherrill
> Information Management Systems
My feeling is about constraint names is that they should have meaning when you get a message from an end-user, or from a record in an error log table, that says that the constraint has been violated.
If you can't immediately translate a constaint name to its table and purpose, the fishing expedition starts. And time is wasted.
-- Daniel Morgan http://www.outreach.washington.edu/extinfo/certprog/oad/oad_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Thu May 01 2003 - 10:23:58 CDT
![]() |
![]() |