Re: Problem with index in OR'd expression

From: postgresql(dot)org(at)tgice(dot)com
To: Ragnar <gnari(at)hive(dot)is>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with index in OR'd expression
Date: 2007-01-01 20:21:33
Message-ID: 45996D4D.3060503@tgice.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ragnar wrote:
> Reguardless of the issue whether pl/pgsql could be expected to
> optimize this case, I find it difficult to imagine a scenario
> where this kind of coding makes sense.
>
> I understand that in some cases on would like to do this with
> a *variable* to simplify logic, but what possible gain can
> be had from doing this with a constant, other that obfuscation?

Well, in one way it's a variable, but in another a constant. It's a
variable in the context of general PG usage... e.g., my application code
may call the function with whatever parameters a user chooses, leaving
some parameters null and others not.

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?

Thanks for your response.

jl

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message brian 2007-01-01 21:16:57 spooky refusal to insert
Previous Message Magnus Hagander 2007-01-01 19:14:13 Re: Installing support for python on windows