On Tue, Jun 14, 2011 at 1:25 PM, Simon Riggs <simon@2ndquadrant.com> wrote:
>
> We can work out the various paths through the traffic cop to see when
> a plan will be a "one-shot" - planned and then executed immediately,
> then discarded.
>
> In those cases we can take advantage of better optimisations. Most
> interestingly, we can evaluate stable functions at plan time, to allow
> us to handle partitioning and partial indexes better.
>
> Patch attached. Works...
>
this breaks test guc.c for me... specifically the test at
src/test/regress/sql/guc.sql circa line 226:
"""
set work_mem = '3MB';
-- but SET isn't
create or replace function myfunc(int) returns text as $$
begin set work_mem = '2MB'; return current_setting('work_mem');
end $$
language plpgsql
set work_mem = '1MB';
select myfunc(0), current_setting('work_mem');
"""
regressions.diff
"""
*** 656,662 **** select myfunc(0), current_setting('work_mem'); myfunc | current_setting --------+-----------------
! 2MB | 2MB (1 row)
set work_mem = '3MB';
--- 656,662 ---- select myfunc(0), current_setting('work_mem'); myfunc | current_setting --------+-----------------
! 2MB | 3MB (1 row)
set work_mem = '3MB';
"""
it seems that the effect of SET is being discarded
--
Jaime Casanova www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación