Re: [HACKERS] bug with aggregates

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Massimo Dal Zotto <dz(at)cs(dot)unitn(dot)it>
Cc: hackers(at)postgreSQL(dot)org (PostgreSQL Hackers)
Subject: Re: [HACKERS] bug with aggregates
Date: 1999-06-12 19:55:42
Message-ID: 16827.929217342@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Massimo Dal Zotto <dz(at)cs(dot)unitn(dot)it> writes:
> dz=> select count(1) from my_table;
> pqReadData() -- backend closed the channel unexpectedly.

Poking into this failure revealed a potentially serious problem in
execQual.c, so I decided it would be wise to fix it now rather than
wait till after 6.5. In the situation where ExecTargetList() is asked
to generate a null tuple --- which arises in the case above, and
evidently in other cases judging from the comments there and the
multiple bogus ways that people have tried to fix it before ---
it was handing back a palloc'd but uninitialized chunk of memory.
This would result in unpredictable behavior if anyone actually tried
to do anything with the tuple. In the case above, nodeAgg.c tried to
copy the tuple, leading to coredumps some of the time. I fixed
ExecTargetList to generate a valid tuple containing zero attributes,
which should work reliably.

I had managed to break the planner's handling of this case too, so I
figured I would fix that as long as I was annoying Marc anyway ;-).

The behavior is now back to that of 6.4.2: you get "1" when the query is
not grouped and row counts when it is. I still think that that's wrong,
but I will not risk trying to change it just before release.

regards, tom lane

Browse pgsql-hackers by date

  From Date Subject
Next Message Oliver Elphick 1999-06-12 20:02:06 Re: [HACKERS] Re: [PORTS] Patch for m68k architecture
Previous Message Edmund Mergl 1999-06-12 19:46:45 Re: [HACKERS] destroydb doesn't close connection with client (httpd <-> pg)