On Sat, Dec 10, 2005 at 12:57:13PM -0500, Tom Lane wrote: > "" <[EMAIL PROTECTED]> writes: > > Description: EXPLAIN ANALYZE with SELECT query causes a single > > backend server process to segfault > > Could you provide a self-contained test case, please?
Here's a test case: CREATE TABLE foo (x integer); EXPLAIN SELECT CASE x = 1 WHEN true THEN 1 ELSE 0 END AS y FROM foo ORDER BY y; I get a segfault in 8.1.1 with EXPLAIN but not for the query alone. Here's the stack trace: #0 0x081bfdcf in get_rule_expr (node=0x83ac460, context=0xbfbfd4b0, showimplicit=80 'P') at pg_list.h:82 #1 0x081c0e73 in deparse_expression_pretty (expr=0x83ac460, dpcontext=0x83ac7b0, forceprefix=0 '\0', showimplicit=1 '\001', prettyFlags=32, startIndent=32) at ruleutils.c:1388 #2 0x080ef4a5 in explain_outNode (str=0x83ac648, plan=0x83ac388, planstate=0x83ad1f0, outer_plan=0x0, indent=0, es=0x83ac638) at explain.c:1160 #3 0x080ef90d in ExplainOnePlan (queryDesc=0x83ac5f0, stmt=0x835b708, tstate=0x8305b00) at explain.c:282 #4 0x080efca5 in ExplainOneQuery (query=0x83c7580, stmt=0x835b708, tstate=0x8305b00) at explain.c:214 #5 0x080efdcd in ExplainQuery (stmt=0x835b708, dest=0x83c7530) at explain.c:121 #6 0x0818cb2f in PortalRunUtility (portal=0x83ca018, query=0x835b228, dest=0x83c7530, completionTag=0x0) at pquery.c:987 #7 0x0818ce16 in PortalRun (portal=0x83ca018, count=2147483647, dest=0x835b748, altdest=0x835b748, completionTag=0xbfbfd7b0 "") at pg_list.h:81 #8 0x08189127 in exec_simple_query (query_string=0x835b018 "EXPLAIN\nSELECT CASE x = 1 WHEN true THEN 1 ELSE 0 END AS y\nFROM foo\nORDER BY y;") at postgres.c:1002 #9 0x0818b693 in PostgresMain (argc=4, argv=0x82e4d98, username=0x82e4d78 "mfuhr") at postgres.c:3168 #10 0x081684e6 in ServerLoop () at postmaster.c:2853 #11 0x08169a01 in PostmasterMain (argc=3, argv=0xbfbfecb8) at postmaster.c:943 #12 0x08133612 in main (argc=3, argv=0xbfbfecb8) at main.c:256 -- Michael Fuhr ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match