Re: database constraints

From: David Fetter <david(at)fetter(dot)org>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Ben <bench(at)silentmedia(dot)com>, Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: database constraints
Date: 2004-10-06 16:43:56
Message-ID: 20041006164356.GC30061@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wed, Oct 06, 2004 at 09:32:02AM -0700, Joshua D. Drake wrote:

> >What's "reasonable?" ;)
> >
> >BTW, "id" is a terrible name for a column. Better call it foo_id.
>
> Hello,
>
> I disagree with the idea that "id" is a terrible name for a column. The
> only negative to it, is that you will have to be explicit in your
> declarations when doing joins and such... ex:
>
> SELECT * FROM foo
> JOIN bar on (foo.id = bar.id)
>
> Personally I would rather see, and write that then:
>
> SELECT * FROM foo
> JOIN bar on (foo_id = bar_id)

With all due respect, Josh, naming your columns with decipherable
names, i.e. *not* having 50 different things called "id" in your db
helps enormously with maintenance, especially when the current
maintainer has never met the designer, a common situation. Also, many
databases have documents that are inadequate, out of date, or both, so
decipherable names, along with as much other self-documentation, is a
big plus.

Cheers,
D

P.S. As a rule, SELECT * doesn't belong in production code.</nit>
--
David Fetter david(at)fetter(dot)org http://fetter.org/
phone: +1 510 893 6100 mobile: +1 415 235 3778

Remember to vote!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kris Jurka 2004-10-06 16:47:02 Re: RE : Postgres 8.0 + JDBC
Previous Message Kris Jurka 2004-10-06 16:40:31 Re: Avoiding explicit addDataType calls for PostGIS

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Wong 2004-10-06 17:01:42 Re: FunctionCall2 performance
Previous Message Bruce Momjian 2004-10-06 16:35:20 Re: Pl/perl broken on Windows