Re: Functional dependencies and GROUP BY - for subqueries

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Functional dependencies and GROUP BY - for subqueries
Дата
Msg-id 10862.1366986290@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Functional dependencies and GROUP BY - for subqueries  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
Ответы Re: Functional dependencies and GROUP BY - for subqueries
Список pgsql-hackers
Ashutosh Bapat <ashutosh.bapat@enterprisedb.com> writes:
> The reason being, it doesn't look into the subqueries (in FROM clause) to
> infer that p.product_id is essentially product.product_id which is a
> primary key.

Right.

> Attached find a crude patch to infer the same by traversing subqueries.

I think this is probably a bad idea.  We could spend an infinite amount
of code this way, with ever-increasing runtime cost and ever-decreasing
usefulness, and where would we stop?  I'm also a bit concerned about
allowing illegal queries due to bugs of omission in the
ever-more-complex checking code, which could be quite hard to find, and
when we did find them we'd be faced with a backwards compatibility break
if we fix them.

A larger point is that the patch as proposed doesn't fix the stated
problem, because it only descends into written-out subqueries.  It
would only succeed at looking into views if we applied it after
rewriting, rather than in the parser.  That's really not going to work.
It would be a complete disaster if the dependencies of a query that
references a view depend on the view's contents.
        regards, tom lane



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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Substituting Checksum Algorithm (was: Enabling Checksums)
Следующее
От: Robert Haas
Дата:
Сообщение: Re: libpq COPY handling