From: | "Karsten Hilbert" <Karsten(dot)Hilbert(at)gmx(dot)net> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: What are the (various) best practices/opinions for table/column/constraint naming? |
Date: | 2008-02-09 10:58:35 |
Message-ID: | 20080209105835.240720@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
in such 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 bad design).
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
From | Date | Subject | |
---|---|---|---|
Next Message | Shane Ambler | 2008-02-09 14:16:21 | Re: Postgres roles |
Previous Message | Ken Johanson | 2008-02-08 21:04:37 | What are the (various) best practices/opinions for table/column/constraint naming? |