Re: if-clause to an exiting statement

Поиск
Список
Период
Сортировка
От Rob Sargent
Тема Re: if-clause to an exiting statement
Дата
Msg-id 4D0B5FBE.6010708@gmail.com
обсуждение исходный текст
Ответ на Re: if-clause to an exiting statement  (Jasen Betts <jasen@xnet.co.nz>)
Список pgsql-general

Jasen Betts wrote:
> On 2010-12-07, Kobi Biton <kobi@comns.co.il> wrote:
>
>> hi i am a newbie to sql statments  , I am running postgres 8.1 with
>> application called opennms version 1.8.5 due to an application bug
>> queries that I execute aginst the DB which returns raw-count=0 are being
>> ignored and will not process a certain trigger I need to process.
>>
>
> I think you want this:
>
>  ORIGINAL QUERY
>  union
>    select DUMMY ROW DATA
>  where
>    not exists ( ORIGINAL QUERY )
>
>
> you need to return something to get a rowcount of 1 this is what the
> dummy row data provides. the "where not exists" part blocks the dummy
> row data when the main query returns something.
>
>

Simple enough, but I suspect it runs the same query twice, so I hope
it's not to expensive.  I wonder what the app is/was doing with the
vacuous single row  or will do with the dummy data row?  Seems the
app/trigger simply needs to know the execution of the query was
successful irrespective of the actual row count - or is that the bug
with "1.8.5"?

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

Предыдущее
От: Sandeep Srinivasa
Дата:
Сообщение: Re: Simple, free PG GUI/query tool wanted
Следующее
От: Marcin Krol
Дата:
Сообщение: Recommended replication solution?