Re: [HACKERS] Passing query string to workers - Mailing list pgsql-hackers

From Kuntal Ghosh
Subject Re: [HACKERS] Passing query string to workers
Date
Msg-id CAGz5QCLVp+pbRSSp8P-pmVdhPXEe493JjEjixZVrmGB9mU5LQA@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Passing query string to workers  (Rafia Sabih <rafia.sabih@enterprisedb.com>)
Responses Re: [HACKERS] Passing query string to workers  (Rafia Sabih <rafia.sabih@enterprisedb.com>)
List 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 by date:

Previous
From: Andres Freund
Date:
Subject: [HACKERS] "may be unused" warnings for gcc
Next
From: Jim Mlodgenski
Date:
Subject: [HACKERS] mat views stats