Yeah, it crashes on debug build with asserts enabled when
planning.
In fact, it's possible to reproduce on a smaller query:
EXPLAIN SELECT
True
FROM
link
INNER JOIN (SELECT id FROM b
UNION ALL SELECT id FROM d) AS v
ON (link.target = v.id);
On non-debug build EXPLAIN works, but running it crashes in
ExecEvalScalarVar:
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000000596dd5 in ExecEvalScalarVar ()
(gdb) bt
#0 0x0000000000596dd5 in ExecEvalScalarVar ()
#1 0x00000000005a4f98 in ExecIndexEvalRuntimeKeys ()
#2 0x00000000005a66e8 in ExecReScanIndexOnlyScan ()
#3 0x000000000059057d in ExecReScan ()
#4 0x00000000005a66a5 in ExecIndexOnlyScan ()
#5 0x0000000000594498 in ExecProcNode ()
#6 0x000000000059f57f in ExecAppend ()
#7 0x00000000005944e8 in ExecProcNode ()
#8 0x00000000005aab87 in ExecNestLoop ()
#9 0x0000000000594408 in ExecProcNode ()
#10 0x0000000000591aa0 in standard_ExecutorRun ()
#11 0x0000000000678aa8 in PortalRunSelect ()
#12 0x0000000000679e2f in PortalRun ()
#13 0x0000000000677bc3 in PostgresMain ()
#14 0x000000000046adef in main ()
Elvis
On September 17, 2014 02:50:34 PM Tom Lane wrote:
> Elvis Pranskevichus <elprans@gmail.com> writes:
> > Postgres 9.4beta2 and later crashes given the following
query:
> Thanks for the test case. Reproduces for me in HEAD, will
> look into it later.
>
> > Which generates the following query plan:
> I'm a bit confused about your statement that it produces this
> query plan, since AFAICS it crashes before getting that far.
>
> regards, tom lane