Re: [HACKERS] Passing query string to workers

Поиск
Список
Период
Сортировка
От Kuntal Ghosh
Тема Re: [HACKERS] Passing query string to workers
Дата
Msg-id CAGz5QCLVp+pbRSSp8P-pmVdhPXEe493JjEjixZVrmGB9mU5LQA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] Passing query string to workers  (Rafia Sabih <rafia.sabih@enterprisedb.com>)
Ответы Re: [HACKERS] Passing query string to workers  (Rafia Sabih <rafia.sabih@enterprisedb.com>)
Список pgsql-hackers
On Mon, Feb 20, 2017 at 10:11 AM, Rafia Sabih
<rafia.sabih@enterprisedb.com> wrote:
> On Sun, Feb 19, 2017 at 10:11 PM, Robert Haas <robertmhaas@gmail.com> wrote:
>> +       query_data = (char *) palloc0(strlen(estate->es_queryString) + 1);
>> +       strcpy(query_data, estate->es_queryString);
>>
>> It's unnecessary to copy the query string here; you're going to use it
>> later on in the very same function.  That code can just refer to
>> estate->es_queryString directly.
>
>
> Done.
+   char       *query_data;
+   query_data = estate->es_sourceText;
estate->es_sourceText is a const char* variable. Assigning this const
pointer to a non-const pointer violates the rules
constant-correctness. So, either you should change query_data as const
char*, or as Robert suggested, you can directly use
estate->es_sourceText.


-- 
Thanks & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: [HACKERS] "may be unused" warnings for gcc
Следующее
От: Jim Mlodgenski
Дата:
Сообщение: [HACKERS] mat views stats