Re: What are the (various) best practices/opinions for table/column/constraint naming?

Поиск
Список
Период
Сортировка
От Karsten Hilbert
Тема Re: What are the (various) best practices/opinions for table/column/constraint naming?
Дата
Msg-id 20080209105835.240720@gmx.net
обсуждение исходный текст
Ответ на What are the (various) best practices/opinions for table/column/constraint naming?  (Ken Johanson <pg-user@kensystem.com>)
Список 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 по дате отправления:

Предыдущее
От: Ken Johanson
Дата:
Сообщение: What are the (various) best practices/opinions for table/column/constraint naming?
Следующее
От: Shane Ambler
Дата:
Сообщение: Re: Postgres roles