Re: plpgsql: penalty due to double evaluation of parameters
| От | Tom Lane |
|---|---|
| Тема | Re: plpgsql: penalty due to double evaluation of parameters |
| Дата | |
| Msg-id | 4539.1211756820@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: plpgsql: penalty due to double evaluation of parameters ("Heikki Linnakangas" <heikki@enterprisedb.com>) |
| Список | pgsql-hackers |
"Heikki Linnakangas" <heikki@enterprisedb.com> writes:
> I don't buy the performance argument unless I see some test results
> demonstrating it; exec_prepare_plan is only called on the first
> invocation of a statement. What kind of side-effects could
> exec_eval_datum call have?
In principle, if you subscript TG_ARGV[] with an expression that has
visible side-effects, you could have unexpected behavior here. I think
though that the right fix is to get rid of the special treatment of
TG_ARGV[] and make it a ordinary variable with type text[], instead
of being its very own class of datum. The current implementation has
a lot of other misbehaviors for TG_ARGV[], like not being able to apply
array operations to it.
I agree that worrying about the performance is pointless, considering
the cost of the SPI_prepare_cursor() that we're about to do in the one
place where there could be a use for a get-the-type-only call.
regards, tom lane
В списке pgsql-hackers по дате отправления: