From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com> |
Cc: | "Nikhils" <nikkhils(at)gmail(dot)com>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>, rushabh(dot)lathia(at)gmail(dot)com |
Subject: | Re: plpgsql: penalty due to double evaluation of parameters |
Date: | 2008-05-25 23:07:00 |
Message-ID: | 4539.1211756820@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
"Heikki Linnakangas" <heikki(at)enterprisedb(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2008-05-25 23:45:21 | Read Uncommitted |
Previous Message | Tom Lane | 2008-05-25 22:50:32 | Re: BUG #4186: set lc_messages does not work |