Dimitri Fontaine <dimitri@2ndQuadrant.fr> writes:
> Now that you mention it, the following might actually already work:
> WITH settings AS (
> SELECT set_config('timezone', 'Europe/Amsterdam', t),
> set_config('work_mem', '1 GB', t)
> ),
> foo AS (
> SELECT …
> )
> INSERT INTO bar SELECT * FROM foo;
Only for small values of "work" ... you won't be able to affect planner
settings that way, nor can you assume that that WITH item is executed
before all else. See recent thread pointing out that setting values
mid-query is unsafe.
regards, tom lane