Re: How to get value of 'Param' of the WHERE clause in the FDW?

Поиск
Список
Период
Сортировка
От Dmitry Chichkov
Тема Re: How to get value of 'Param' of the WHERE clause in the FDW?
Дата
Msg-id CADeuJh6PeE5p2fxgPzgjGZS+rLRBdkUeh2Cb42sBtxSktW0=JQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How to get value of 'Param' of the WHERE clause in the FDW?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: How to get value of 'Param' of the WHERE clause in the FDW?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Thank you for the reply!  I'm trying to get the correct value and I need it at the execution stage.  I just don't see how to get baserestrictinfo in the execution stage or if the 'abc123' value would be there at all...

Kind regards,
Dmitry

On Fri, Sep 25, 2015 at 11:44 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Dmitry Chichkov <dchichkov@gmail.com> writes:
> It seems like during fdwPlan(..., RelOptInfo *baserel) stage I'm getting
> baserel->baserestrictinfo, in which I see a Node *x  of  IsA(x, Param).
> But it looks like the value 'abc123' is not yet available in the planning
> stage, right?   And I don't see how can I get baserestrictinfo in the
> execution stage or if the 'abc123' value would be there...

If you are trying to get an estimated value for some subexpression at plan
time, estimate_expression_value() is what to use; see for example the uses
of that function in selfuncs.c.  Keep in mind that it *is* an estimate and
cannot be guaranteed to still be correct at execution time, since the plan
might be re-used with another parameter value.

                        regards, tom lane

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

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: Less than ideal error reporting in pg_stat_statements
Следующее
От: Tom Lane
Дата:
Сообщение: Re: upcoming infrastructure changes/OS upgrades on *.postgresql.org