Support external parameters in EXECUTE command

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Support external parameters in EXECUTE command
Дата
Msg-id 308bff6b-980c-f992-86c2-f4df12db3de2@2ndquadrant.com
обсуждение исходный текст
Ответы Re: Support external parameters in EXECUTE command  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Continuing the discussion in [0], here is a patch that allows parameter 
references in the arguments of the EXECUTE command.  The main purpose is 
submitting protocol-level parameters, but the added regression test case 
shows another way to exercise it.

What's confusing is that the code already contains a reference that 
indicates that this should be possible:

     /* Evaluate parameters, if any */
     if (entry->plansource->num_params > 0)
     {
         /*
          * Need an EState to evaluate parameters; must not delete it 
till end
          * of query, in case parameters are pass-by-reference.  Note 
that the
          * passed-in "params" could possibly be referenced in the parameter
          * expressions.
          */
         estate = CreateExecutorState();
         estate->es_param_list_info = params;
         paramLI = EvaluateParams(pstate, entry, stmt->params, estate);
     }

I'm not sure what this is supposed to do without my patch on top of it. 
If I remove the estate->es_param_list_info assignment, no tests fail 
(except the one I added).  Either this is a leftover from previous 
variants of this code (as discussed in [0]), or there is something I 
haven't understood.


[0]: 
https://www.postgresql.org/message-id/flat/6e7aa4a1-be6a-1a75-b1f9-83a678e5184a%402ndquadrant.com

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Just for fun: Postgres 20?
Следующее
От: Shichao Jin
Дата:
Сообщение: Re: Memory-comparable Serialization of Data Types