Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id A55692E0123 for ; Sat, 9 Feb 2008 06:58:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 08793-01 for ; Sat, 9 Feb 2008 06:58:34 -0400 (AST) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by postgresql.org (Postfix) with SMTP id F14022E013B for ; Sat, 9 Feb 2008 06:58:37 -0400 (AST) Received: (qmail 16713 invoked by uid 0); 9 Feb 2008 10:58:35 -0000 Received: from 87.172.152.225 by www049.gmx.net with HTTP; Sat, 09 Feb 2008 11:58:35 +0100 (CET) Content-Type: text/plain; charset="iso-8859-1" Date: Sat, 09 Feb 2008 11:58:35 +0100 From: "Karsten Hilbert" In-Reply-To: <47ACC3E5.2060207@kensystem.com> Message-ID: <20080209105835.240720@gmx.net> MIME-Version: 1.0 References: <47ACC3E5.2060207@kensystem.com> Subject: Re: What are the (various) best practices/opinions for table/column/constraint naming? To: pgsql-sql@postgresql.org X-Authenticated: #1433807 X-Flags: 0001 X-Mailer: WWW-Mail 6100 (Global Message Exchange) X-Priority: 3 X-Provags-ID: V01U2FsdGVkX1+KLyx4Nq+KW87J64uxuf90ujE2r8erZwPR1mm8qn 4bidSx3EljRZ0d0s/wXiy2lUSx61D8Z/si8w== Content-Transfer-Encoding: 8bit X-GMX-UID: arWLbyH5Li50N+fEf2tpBKprZml1ZFi+ X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/65 X-Sequence-Number: 30156 Speaking on behalf of the GNUmed schema. The type of thing comes first for consistency. primary key: pk Some might argue pk_ 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_ This then affords fk__ should that ever be needed (likely an indication of bad design). indices: idx__ sequences: so far we relied on PG giving us a name constraints: named by what they *do*, such as ensure_..._consistency functions: f_ trigger functions: trf_ trigger: tr_ > 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