bug with aggregates - Mailing list pgsql-hackers

From Massimo Dal Zotto
Subject bug with aggregates
Date
Msg-id 199906111952.VAA23285@nikita.wizard.net
Whole thread Raw
Responses Re: [HACKERS] bug with aggregates
Re: [HACKERS] bug with aggregates
Re: [HACKERS] bug with aggregates
List pgsql-hackers
Hi,

while playing with aggregates I found this bug in the planner:

dz=> select count(1) from my_table;
pqReadData() -- backend closed the channel unexpectedly.       This probably means the backend terminated abnormally
  before or while processing the request.
 
We have lost the connection to the backend, so further processing is impossible.  Terminating.

The debugger prints the following information:

(xxgdb) cont
Program received signal SIGSEGV, Segmentation fault.
0x80d93cf in set_agg_tlist_references (aggNode=0x82a4310) at setrefs.c:765
(xxgdb) info stack
#0  0x80d93cf in set_agg_tlist_references (aggNode=0x82a4310) at setrefs.c:765
#1  0x80d80ac in union_planner (parse=0x82a40a0) at planner.c:319
#2  0x80d7d05 in planner (parse=0x82a40a0) at planner.c:83
#3  0x80fd344 in pg_parse_and_plan (query_string=0xbffef2d8 "select count(1) from my_table;", typev=0x0, nargs=0,
queryListP=0xbffef268,dest=Remote, aclOverride=0 '\000') at postgres.c:590
 
#4  0x80fd4a3 in pg_exec_query_dest (query_string=0xbffef2d8 "select count(1) from my_table;", dest=Remote,
aclOverride=0)at postgres.c:678
 
#5  0x80fd454 in pg_exec_query (query_string=0xbffef2d8 "select count(1) from my_table;") at postgres.c:656
#6  0x80fe6c8 in PostgresMain (argc=9, argv=0xbffff850, real_argc=6, real_argv=0xbffffd6c) at postgres.c:1658
#7  0x80e32ec in DoBackend (port=0x8235ca8) at postmaster.c:1628
(xxgdb) print *aggNode
$2 = { plan = {   type = T_Agg,    cost = 0,    plan_size = 0,    plan_width = 0,    plan_tupperpage = 0,    state =
0x0,   targetlist = 0x82a44f8,    qual = 0x0,    lefttree = 0x0,    righttree = 0x0,    extParam = 0x0,    locParam =
0x0,   chgParam = 0x0,    initPlan = 0x0,    subPlan = 0x0,    nParamExec = 0 },  aggs = 0x0,  aggstate = 0x0
 
}
(xxgdb) 

The problem is caused by a null plan.lefttree in set_agg_tlist_references()
(setrefs.c:765), but I don't know what it means:
subplanTargetList = aggNode->plan.lefttree->targetlist;

-- 
Massimo Dal Zotto

+----------------------------------------------------------------------+
|  Massimo Dal Zotto               email: dz@cs.unitn.it               |
|  Via Marconi, 141                phone: ++39-0461534251              |
|  38057 Pergine Valsugana (TN)      www: http://www.cs.unitn.it/~dz/  |
|  Italy                             pgp: finger dz@tango.cs.unitn.it  |
+----------------------------------------------------------------------+


pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: [HACKERS] Re: [PORTS] Patch for m68k architecture
Next
From: Bruce Momjian
Date:
Subject: Re: patch for large queries