Re: Propogating conditions into a query

From: Phil Endecott <spam_from_postgresql_general(at)chezphil(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: Propogating conditions into a query
Date: 2005-06-09 17:34:09
Message-ID: 42A87D91.6040108@chezphil.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> Phil Endecott <spam_from_postgresql_general(at)chezphil(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-06-09 17:56:33 Re: postgreSQL 7.3.8, pg_dump not able to find large o
Previous Message Tom Lane 2005-06-09 17:17:16 Re: Propogating conditions into a query