Pivotal Knowledge Base

Follow

Query with median function fails with "ERROR: variable not found in subplan target list"

Environment

Pivotal Greenplum Database < 4.2.7.2 / 4.3.1.0

Problem

The select fails with the error message

ERROR:  variable not found in subplan target list (setrefs.c:2031)

A simple repro to reproduce the problem

create table p1(id1 varchar(10), id2 numeric(6,2));
select id1,median(id2) from p1 group by 1;

Cause

This is identified as a Pivotal Greenplum database bug (internal bug reference: MPP-22219), which is caused due to bad optimizer plan.

Solution

Please upgrade to database version 4.2.7.2 / 4.3.1.0 or above where the issue is fixed.

Comments

Powered by Zendesk