From: | Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com> |
---|---|
To: | Rafia Sabih <rafia(dot)sabih(at)enterprisedb(dot)com> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Passing query string to workers |
Date: | 2017-02-20 15:05:15 |
Message-ID: | CAGz5QCLVp+pbRSSp8P-pmVdhPXEe493JjEjixZVrmGB9mU5LQA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Feb 20, 2017 at 10:11 AM, Rafia Sabih
<rafia(dot)sabih(at)enterprisedb(dot)com> wrote:
> On Sun, Feb 19, 2017 at 10:11 PM, Robert Haas <robertmhaas(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Mlodgenski | 2017-02-20 15:06:25 | mat views stats |
Previous Message | Andres Freund | 2017-02-20 14:41:18 | "may be unused" warnings for gcc |