Re: Problem with index in OR'd expression

Поиск
Список
Период
Сортировка
От postgresql.org@tgice.com
Тема Re: Problem with index in OR'd expression
Дата
Msg-id 45996D4D.3060503@tgice.com
обсуждение исходный текст
Ответ на Re: Problem with index in OR'd expression  (Ragnar <gnari@hive.is>)
Ответы Re: Problem with index in OR'd expression  (Ragnar <gnari@hive.is>)
Список 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: Installing support for python on windows
Следующее
От: brian
Дата:
Сообщение: spooky refusal to insert