Re: BUG #5145: Complex query with lots of LEFT JOIN causes segfault - Mailing list pgsql-bugs

From Stefan Kaltenbrunner
Subject Re: BUG #5145: Complex query with lots of LEFT JOIN causes segfault
Date
Msg-id 4AEA05B6.9080203@kaltenbrunner.cc
Whole thread Raw
In response to Re: BUG #5145: Complex query with lots of LEFT JOIN causes segfault  ("Bernt M. Johnsen" <Bernt.Johnsen@Sun.COM>)
Responses Re: BUG #5145: Complex query with lots of LEFT JOIN causes segfault
Re: BUG #5145: Complex query with lots of LEFT JOIN causes segfault
List pgsql-bugs
Bernt M. Johnsen wrote:
>>>>>>>>>>>>> Euler Taveira de Oliveira wrote (2009-10-29 12:17:36):
>> Bernt Marius Johnsen escreveu:
>>> The below query generated by the Random Query Generator
>>> (https://launchpad.net/randgen) causes a segfault. It was caused running
>>>
>
> Checkout the latest RQG from launchpad and run ./gentest.pl as shown
> above (The lastest tarball misses a feature you need). xx.yy is
> attached.
>
> Run like this:
> ./gentest.pl --dsn=dbi:Pg:user=xxxx --gendata --queries=100000 --threads=1 --grammar=/path/to/xx.yy
>
>
>
>> Could you get a core dump and post the gdb backtrace?
>>
>> $ ulimit -c unlimited
>> $ pg_ctl start
>> $ psql -c "<my query goes here>" mydb
>> $ gdb /path/to/postgres $PGDATA/core
>> (gdb) bt
>> .
>> .
>> .
>> (gdb) quit
>
> We'll see next week If I can spare some time.

I can easily reproduce the segfault on 8.4 and 8.5a2:

Program received signal SIGSEGV, Segmentation fault.
ExecHashJoinSaveTuple (tuple=0xb49c8870, hashvalue=3316173823,
fileptr=0x96185a8) at nodeHashjoin.c:775
775        BufFile    *file = *fileptr;
(gdb) bt
#0  ExecHashJoinSaveTuple (tuple=0xb49c8870, hashvalue=3316173823,
fileptr=0x96185a8) at nodeHashjoin.c:775
#1  0x081cf21f in ExecHashJoin (node=0x88c6540) at nodeHashjoin.c:224
#2  0x081bd898 in ExecProcNode (node=0x88c6540) at execProcnode.c:427
#3  0x081bc445 in standard_ExecutorRun (queryDesc=0x875d22c,
direction=ForwardScanDirection, count=0) at execMain.c:1187
#4  0x0828215c in PortalRunSelect (portal=0x879197c, forward=1 '\001',
count=0, dest=0xb4f7bfb8) at pquery.c:953
#5  0x082834be in PortalRun (portal=0x879197c, count=2147483647,
isTopLevel=1 '\001', dest=0xb4f7bfb8, altdest=0xb4f7bfb8,
     completionTag=0xbfe8ff9a "") at pquery.c:807
#6  0x0827f760 in exec_simple_query (
     query_string=0x8751d3c " SELECT * from   B AS alias0  LEFT JOIN
     BB AS alias1  LEFT JOIN    B AS alias2  LEFT JOIN     A AS alias3
LEFT JOIN   AA AS alias4  LEFT JOIN  B AS alias5 ON alias4.int_key =
alias5.int_key  O"...) at postgres.c:1000
#7  0x08280b8e in PostgresMain (argc=2, argv=0x86d7960,
username=0x86d7928 "mastermind") at postgres.c:3573
#8  0x082499be in ServerLoop () at postmaster.c:3366
#9  0x0824a9db in PostmasterMain (argc=3, argv=0x86d5a98) at
postmaster.c:1064
#10 0x081ea466 in main (argc=3, argv=0x86d5a98) at main.c:188


Stefan

pgsql-bugs by date:

Previous
From: "Bernt M. Johnsen"
Date:
Subject: Re: BUG #5145: Complex query with lots of LEFT JOIN causes segfault
Next
From: Tom Lane
Date:
Subject: Re: BUG #5145: Complex query with lots of LEFT JOIN causes segfault