Re: Propogating conditions into a query - Mailing list pgsql-general

From Phil Endecott
Subject Re: Propogating conditions into a query
Date
Msg-id 42A87D91.6040108@chezphil.org
Whole thread Raw
In response to Re: Propogating conditions into a query  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane wrote:
> Phil Endecott <spam_from_postgresql_general@chezphil.org> writes:
>>>D join (M join G on (M.g=G.id)) on (D.id=M.b) where D.id=nnn
>
> 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

I don't suppose it would work if I did

D left join (M join G on (M.g=G.id)) on (D.id=M.b)
     where (D.id=nnn AND (M.b=nnn or M.b IS NULL))

would it?

Otherwise it breaks the view, and makes the calling code rather more messy.

--Phil.



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Propogating conditions into a query
Next
From: Tom Lane
Date:
Subject: Re: postgreSQL 7.3.8, pg_dump not able to find large o