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

Поиск
Список
Период
Сортировка
От Neha Khatri
Тема [NOVICE] Why is there a doubtful copyObject call in add_vars_to_targetlist
Дата
Msg-id CAFO0U+9oT7fBG8oUWN3B_sd0i_rfvoQ45LhSmeUQzhRQf_Y3-g@mail.gmail.com
обсуждение исходный текст
Список pgsql-novice
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

В списке pgsql-novice по дате отправления:

Предыдущее
От: Yaser Raja
Дата:
Сообщение: Re: [NOVICE] Adding a third DR PostgreSQL native replication
Следующее
От: Herman Bergwerf
Дата:
Сообщение: [NOVICE] Extend GIN