On mán, 2007-01-01 at 14:21 -0600, postgresql.org@xxxxxxxxx wrote: > Within the context of the function (after calling), these variables are > constant and I'm attempting to use my OR syntax as shorthand to avoid > having to use a dynamic statement *only* because of this situation. > As I've mentioned, this approach seems to work with MSSQL 6.5+, which I > assume we consider as a valid competitor to PG... if this didn't work > anywhere else, I probably wouldn't even have brought it up. > > I'll re-iterate another question I attempted to pose which was: what > have other PG application developers done in this situation? Is it most > common to just use dynamic statements? ps/pgsql will prepare the statement caching the plan for subsequent calls, thus making this not easily optimized. to avoid this in ps/pgsql , I believe it is common to to make the statement dynamic by using EXECUTE, thus in effect making sure the query is planned each time. gnari