Skip site navigation (1) Skip section navigation (2)

Re: Doubt about boundParams

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Doubt about boundParams
Date: 2011-08-02 10:53:26
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Tue, Aug 2, 2011 at 3:45 PM, Heikki Linnakangas <
heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:

> On 02.08.2011 12:54, Ashutosh Bapat wrote:
>> Hi All,
>> I am looking at usage of bound parameters.
>> In functions SPI_cursor_open_with_args() and SPI_cursor_open_with_args()
>> parameters are flagged as constants and passed to the planner in following
>> manner,
>> paramLI = _SPI_convert_params(nargs, argtypes,
>>                                    Values, Nulls,
>>                                    PARAM_FLAG_CONST);
>>  _SPI_prepare_plan(src,&plan, paramLI);
>> The bound params "paramLI" are then passed to the planner as boundParams.
>> Before actually planning the query, these parameters are evaluated duing
>> constant evaluation (eval_const_expressions_**mutator()), and the Param
>> nodes
>> are replaced with Constant nodes.
>> Further, while executing such queries we pass the paramLI structure to the
>> execution routine e.g. _SPI_execute_plan(). These parameter values are
>> stored in "EState" structure. But, since these parameters are already
>> folded
>> into queries, it looks like parameter values stored in EState are never
>> used.
>> Is this correct? Or somewhere we use those parameter values?
> That is correct, at the moment. PARAM_FLAG_CONST means that the planner is
> free evaluate the params during planning, but it doesn't have to. You still
> need to pass the params in _SPI_execute_plan() in case the planner decided
> to not convert some params to Consts, even though as the code stands today
> it always will.

Ok, thanks.

> --
>  Heikki Linnakangas
>  EnterpriseDB

Best Wishes,
Ashutosh Bapat
EntepriseDB Corporation
The Enterprise Postgres Company

In response to

pgsql-hackers by date

Next:From: Heikki LinnakangasDate: 2011-08-02 11:03:47
Subject: Re: Hot standby and GiST page splits (was Re: WIP: Fast GiST index build)
Previous:From: Heikki LinnakangasDate: 2011-08-02 10:15:48
Subject: Re: Doubt about boundParams

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group