• P
    Backport PG patch 67770803 to fix a panic in plancache code. (#5514) · 3883d52c
    Paul Guo 提交于
    Actually we saw this panic on GPDB5. This issue was fixed on PG
    in 2014 and gpdb master does not include this fix yet.
    
    Here is the crash stack on GPDB5.
        \#2  <signal handler called>
        \#3  transformStmt (pstate=pstate@entry=0x1464200, parseTree=parseTree@entry=0x0) at analyze.c:269
        \#4  0x00000000005b5852 in parse_analyze (parseTree=parseTree@entry=0x0, sourceText=sourceText@entry=0x207c8c0 "",
            paramTypes=0x0, numParams=0) at analyze.c:166
        \#5  0x000000000082cbc9 in pg_analyze_and_rewrite (parsetree=0x0, query_string=0x207c8c0 "",
            paramTypes=<optimized out>, numParams=<optimized out>) at postgres.c:811
        \#6  0x000000000092a232 in RevalidateCachedPlanWithParams (plansource=plansource@entry=0x207c830,
            useResOwner=useResOwner@entry=0 '\000', boundParams=boundParams@entry=0x0, intoClause=intoClause@entry=0x0)
            at plancache.c:556
        \#7  0x000000000092a462 in RevalidateCachedPlan (plansource=plansource@entry=0x207c830,
            useResOwner=useResOwner@entry=0 '\000') at plancache.c:665
        \#8  0x0000000000828b1a in exec_bind_message (input_message=input_message@entry=0x7fff0c00a300) at postgres.c:2521
        \#9  0x000000000082b935 in PostgresMain (argc=<optimized out>, argv=argv@entry=0x12e1bb0, dbname=<optimized out>,
            username=<optimized out>) at postgres.c:5309
    
    Here is part of the PG commit message.
    
        commit 67770803
        Author: Tom Lane <tgl@sss.pgh.pa.us>
        Date:   Wed Nov 12 15:58:37 2014 -0500
    
            Explicitly support the case that a plancache's raw_parse_tree is NULL.
    
            This only happens if a client issues a Parse message with an empty query
            string, which is a bit odd; but since it is explicitly called out as legal
            by our FE/BE protocol spec, we'd probably better continue to allow it.
    
            ......
    3883d52c
analyze.c 106.8 KB