Обсуждение: [NOVICE] Why is there a doubtful copyObject call in add_vars_to_targetlist

Поиск
Список
Период
Сортировка

[NOVICE] Why is there a doubtful copyObject call in add_vars_to_targetlist

От
Neha Khatri
Дата:
Hi,

I was debugging that when does the function _copyVar get invoked, and the first hit for that was in the add_vars_to_targetlist. There I happened to see the following comment:

/* XXX is copyObject necessary here? */

Further digging showed that this copyObject got added in the commit 5efe3121: 

+       /* XXX is copyObject necessary here? */
+ rel->targetlist = lappend(rel->targetlist,
+                           create_tl_element((Var *) copyObject(var),
+                                             length(rel->targetlist) + 1));

This copyObject still exits in the current code. So I was wondering if the comment question still holds good and why the question there in first place.
To make a new Var object, copyObject seem to be the right choice, then why the doubt?

Regards,
Neha