Re: database constraints - Mailing list pgsql-general

From David Fetter
Subject Re: database constraints
Date
Msg-id 20041006164356.GC30061@fetter.org
Whole thread Raw
In response to Re: database constraints  ("Joshua D. Drake" <jd@commandprompt.com>)
Responses Re: database constraints  ("Joshua D. Drake" <jd@commandprompt.com>)
Re: database constraints  (David Garamond <lists@zara.6.isreserved.com>)
List pgsql-general
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@fetter.org http://fetter.org/
phone: +1 510 893 6100   mobile: +1 415 235 3778

Remember to vote!

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: database constraints
Next
From: Bruno Wolff III
Date:
Subject: Re: Random not so random