max( bool )?

From: Cedar Cox <cedarc(at)visionforisrael(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: max( bool )?
Date: 2001-04-04 12:32:57
Message-ID: Pine.LNX.4.21.0104041417120.7152-100000@nanu.visionforisrael.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 tblstsc1options
where '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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message tjk@tksoft.com 2001-04-04 14:22:43 Re: outer joins
Previous Message Albert REINER 2001-04-04 11:04:23 Historical dates in Timestamp