Re: Cartesian product bug?

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Cartesian product bug?
Дата
Msg-id 87oevt6w49.fsf@stark.dyndns.tv
обсуждение исходный текст
Ответ на Re: Cartesian product bug?  ("scott.marlowe" <scott.marlowe@ihs.com>)
Ответы Re: Cartesian product bug?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-general
"scott.marlowe" <scott.marlowe@ihs.com> writes:

> On Fri, 31 Oct 2003, Tom Lane wrote:
>
> > (Personally I think NATURAL JOIN is an evil, bug-prone construct,
> > precisely because coincidental matches of column names will mess up your
> > results.)
>
> Me too.  When I first saw it, I figured it would "naturally join" the two
> tables on their fk/pk relation if there was one.  That seems natural.
> Joining on two fields that just happen to have the same name is unnatural
> to me.

Well 99% of the time I impose on myself a constraint to only use the same name
iff they refer to the same attribute. So if they have the same name then they
really ought to be a reasonable join clause.

However the 1% are things like "date_created, date_updated" or even flags like
"active", "deleted" etc. Which are more than enough to make it utterly
useless.

Too bad really, it would be a handy thing for ad-hoc queries typed at psql. It
would still seem too fragile for production queries though.

--
greg

В списке pgsql-general по дате отправления:

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Constraint Problem
Следующее
От: Martin Marques
Дата:
Сообщение: Re: Constraint Problem