Cherry-pick dd5ba23: Fix #4471: Undefined index warning with referenced column.

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>