Ulf Mehlig <[EMAIL PROTECTED]> writes: > NOTICE: PortalHeapMemoryFree: 0x0x40b139c8 not in alloc set! > NOTICE: PortalHeapMemoryFree: 0x0x40b139c8 not in alloc set! > > select s_id,nummer, > min(timest::time) as timest, ^^^^^^^^^^^^^^^^^ > round(avg(photo),2),round(stddev(photo),3), It turns out that the problem is in the above min() function: min() and max() are broken in 7.0.* for types time and timetz. The bug is also causing most of the other aggregate results in the query to be garbage, BTW. There is no such bug in current sources because memory management for aggregates is now done in a cleaner fashion. I'll see about making a quick-hack patch for 7.0.3, though. regards, tom lane