Re: COALESCE not filtering well.

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: COALESCE not filtering well.
Дата
Msg-id 407d949e0907060554v88667c1h4fa803a1041aed71@mail.gmail.com
обсуждение исходный текст
Ответ на COALESCE not filtering well.  (Mohan Raj B <brightmohan@gmail.com>)
Список pgsql-general
On Mon, Jul 6, 2009 at 6:37 AM, Mohan Raj B<brightmohan@gmail.com> wrote:

> CREATE OR REPLACE FUNCTION sp_item(itemid integer, itemname character
> varying)


>   WHERE ( ( COALESCE($1,0)=0 OR  itemid=$1) AND (COALESCE($2, '')='' OR
> itemname LIKE '%'||$2||'%') ) LOOP

itemid and itemname are your parameters, they're being substituted in
the query so you're getting 10=10 and NULL LIKE '%'||NULL||'%'

--
greg
http://mit.edu/~gsstark/resume.pdf

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

Предыдущее
От: Sebastien FLAESCH
Дата:
Сообщение: Re: Normalize INTERVAL ouput format in a db driver
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Postgres 8.3.7 Server Crash: failed to add item to the right sibling in index