Re: How get column-wise table info from an arbitrary query?

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: David Johnston <polobo(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How get column-wise table info from an arbitrary query?
Date: 2013-07-30 22:10:29
Message-ID: CAHyXU0xU2_zhA_NH2YL6AO32WVTo+fVAcymQCB2aW+5NMrZStg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jul 30, 2013 at 4:57 PM, David Johnston <polobo(at)yahoo(dot)com> wrote:
> I'm in the "prefix the id column" camp. I do not use "ORM" middle-ware so
> that may be a reason I do not have any difficulties but one of the big
> advantages to table-prefixing generic column names is that you can then make
> the assumption that any two columns with the same name represent the same
> data. It does make "SELECT *" more useful when running interactive queries
> and, more importantly, it makes using NATURAL JOIN and USING (...) much
> easier - and I hate using ON (...) to perform a join (and I never use the
> "FROM a, b WHERE a = b" cartesian join construct).

I would say: most of all it completely defeats useful text searching.
Any ORM (or anything else) that enforces a primary key integer column
named 'id' is bad technology and should be avoided. Schema should
define the 'object model' not the other way around; I'd estimate that
around 20-30% of my life's work has been cleaning up the various dreck
left around by those who fail to grasp that basic principle.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gavin Flower 2013-07-30 22:13:40 Re: How get column-wise table info from an arbitrary query?
Previous Message David Johnston 2013-07-30 21:57:53 Re: How get column-wise table info from an arbitrary query?