max( bool )?

Поиск
Список
Период
Сортировка
От Cedar Cox
Тема max( bool )?
Дата
Msg-id Pine.LNX.4.21.0104041417120.7152-100000@nanu.visionforisrael.com
обсуждение исходный текст
Ответы Re: max( bool )?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
Question and a problem:

I have this query
 select distinct not exists (   select sc1caption from tblstsc1   where (tblstsc1options.surid like surid || '.%'
 or surid=tblstsc1options.surid)     and surid!=tblstsc1options.surid     and sc1caption is not null ) from
tblstsc1optionswhere '164' like surid || '.%' or surid like '164' || '.%' ;
 

Which with current data returns two records, one true and one false.  What
I want to know is if any of the records (fields) are true.  It doesn't
appear max() will do this: ERROR:  Unable to select an aggregate function max(bool)

What can I do?  FYI, this query will be run from within a trigger function
(plpgsql).


Now for the problem..  In attempting to get what I want, I wrote this:

select not exists (select distinct max((select sc1caption from tblstsc1
where (tblstsc1options.surid like surid || '.%' or
surid=tblstsc1options.surid) and surid!=tblstsc1options.surid and
sc1caption is not null)) from tblstsc1options where '164' like surid ||
'.%' or surid like '164' || '.%');

And I get this notice:
 NOTICE:  PortalHeapMemoryFree: 0x0x824a6e8 not in alloc set! NOTICE:  Buffer Leak: [059] (freeNext=54, freePrev=58,
relname=tblstsc1,
blockNum=0, flags=0x14, refcount=-4 -1)

Thanks,
-Cedar



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

Предыдущее
От: Algirdas Šakmanas
Дата:
Сообщение: outer joins
Следующее
От: The Hermit Hacker
Дата:
Сообщение: [7.0.3] optimizing a LIKE query ...