Re: Too many function calls in view with LEFT JOIN - Mailing list pgsql-bugs

From Andreas Heiduk
Subject Re: Too many function calls in view with LEFT JOIN
Date
Msg-id 933433606@web.de
Whole thread Raw
In response to Too many function calls in view with LEFT JOIN  (Andreas Heiduk <Andreas.Heiduk@web.de>)
List pgsql-bugs
Hello!


Tom Lane <tgl@sss.pgh.pa.us> wrote
>
> Andreas Heiduk <Andreas.Heiduk@web.de> writes:
> > If a view which calls a function is LEFT JOINed to a table but not all
> > result rows are matched by some criteria, then the function is called
> > for each row of the view nevertheless.
>
> > Note that this seems to happen only for left joins, not for a inner join.
>
> I believe that's because the column is required to go to NULL in an
> unjoined row.  With a non-strict function, evaluating it after the join
> could yield wrong answers.  Try making the function strict.

First: setting the function to STRICT really cuts down the number of function calls even with the SELECT via view.

But as far as I can tell both queries should always return the same results. So I don't understand why the STRICT does
notmatter in the first query but is necessary in the second one. Especially because the JOIN criterium is not affected
bythe function call. 


Oh, and sorry that I forgot the version: "PostgreSQL 8.1.4 on i486-pc-linux-gnu, compiled by GCC cc (GCC) 4.0.4
20060507(prerelease) (Debian 4.0.3-3)" 

Best regards,
Andreas Heiduk


______________________________________________________________________
XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club!
Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130

pgsql-bugs by date:

Previous
From: claus.pruefer@webcodex.de
Date:
Subject:
Next
From: "Parang Saraf"
Date:
Subject: Re: error starting service on win2k platform