Re: Optimizing nested ConvertRowtypeExpr execution - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: Optimizing nested ConvertRowtypeExpr execution
Date
Msg-id CAFjFpRdqqYguq7j1sbd+U693KMF5UkxHZuEcAfhtZ6Eq-QyqXg@mail.gmail.com
Whole thread Raw
In response to Re: Optimizing nested ConvertRowtypeExpr execution  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Responses Re: Optimizing nested ConvertRowtypeExpr execution
List pgsql-hackers
On Mon, Apr 9, 2018 at 5:34 PM, Kyotaro HORIGUCHI
<horiguchi.kyotaro@lab.ntt.co.jp> wrote:
>
> The new code doesn't seem to work as written.
>
>>   arg = eval_const_expressions_mutator((Node *) cre->arg,
>>                                        context);
>>
>>   /*
>>    * In case of a nested ConvertRowtypeExpr, we can convert the
>>    * leaf row directly to the topmost row format without any
>>    * intermediate conversions.
>>    */
>>   while (arg != NULL && IsA(arg, ConvertRowtypeExpr))
>>       arg = (Node *) castNode(ConvertRowtypeExpr, arg)->arg;
>
> This runs depth-first so the while loop seems to run at most
> once. I suppose that the "arg =" and the while loop are
> transposed as intention.

Yes. I have modelled it after RelableType case few lines above in the
same function.

-- 
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company


pgsql-hackers by date:

Previous
From: Kyotaro HORIGUCHI
Date:
Subject: Re: Fixing a trivial typo in comment in rewriteManip.c
Next
From: Craig Ringer
Date:
Subject: Re: PostgreSQL's handling of fsync() errors is unsafe and risks data loss at least on XFS