Re: Propogating conditions into a query
| От | Tom Lane |
|---|---|
| Тема | Re: Propogating conditions into a query |
| Дата | |
| Msg-id | 14403.1118337436@sss.pgh.pa.us обсуждение |
| Ответ на | Propogating conditions into a query (Phil Endecott <spam_from_postgresql_general@chezphil.org>) |
| Ответы |
Re: Propogating conditions into a query
Re: Propogating conditions into a query |
| Список | pgsql-general |
Phil Endecott <spam_from_postgresql_general@chezphil.org> writes:
> I don't see anything in there about LEFT OUTER JOIN though. Any ideas?
Oh, I missed that part of your message. Hmm, I think the issue is that in
>> D join (M join G on (M.g=G.id)) on (D.id=M.b) where D.id=nnn
the planner deduces M.b=nnn by transitivity, but when the join is an
outer join it can't make the same deduction.
[ thinks some more... ] If we distinguished conditions that hold below
the join from those that hold above it, we could deduce that M.b=nnn can
be enforced below the join even though it might not be true above it.
There's no such mechanism in existence now, though.
A possible workaround is to generate your query like
D left join (M join G on (M.g=G.id)) on (D.id=M.b AND M.b=nnn) where D.id=nnn
but I don't know how practical that is for you.
regards, tom lane
В списке pgsql-general по дате отправления: