Re: What are the (various) best practices/opinions for table/column/constraint naming? - Mailing list pgsql-sql

From Karsten Hilbert
Subject Re: What are the (various) best practices/opinions for table/column/constraint naming?
Date
Msg-id 20080209105835.240720@gmx.net
Whole thread Raw
In response to What are the (various) best practices/opinions for table/column/constraint naming?  (Ken Johanson <pg-user@kensystem.com>)
List pgsql-sql
Speaking on behalf of the GNUmed schema.

The type of thing comes first for consistency.

primary key: pk
  Some might argue pk_<table_name> is preferrable such that  in joins one ist not forced to use column aliases. We do
insuch cases. The "... where table.pk = ..." just seems  soo intuitive.
 

foreign key: fk_<foreign_table_name>
  This then affords fk_<foreign_table_name>_<foreign_table_column>  should that ever be needed (likely an indication of
baddesign).
 

indices: idx_<table>_<column>

sequences: so far we relied on PG giving us a name

constraints: named by what they *do*, such as ensure_..._consistency

functions: f_<purpose>

trigger functions: trf_<purpose>

trigger: tr_<purpose>

> And other naming conventions suggest using mixed/camel case 
> (quoted-identifiers)
We don't use mixed case as that would *require* quoting which is
liable to being forgotten.

Not much help, just our convention.

Karsten
-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer


pgsql-sql by date:

Previous
From: Ken Johanson
Date:
Subject: What are the (various) best practices/opinions for table/column/constraint naming?
Next
From: Shane Ambler
Date:
Subject: Re: Postgres roles