Re: proposal: set GUC variables for single query - Mailing list pgsql-hackers

From Tom Lane
Subject Re: proposal: set GUC variables for single query
Date
Msg-id 2120.1318798735@sss.pgh.pa.us
Whole thread Raw
In response to Re: proposal: set GUC variables for single query  (Dimitri Fontaine <dimitri@2ndQuadrant.fr>)
Responses Re: proposal: set GUC variables for single query  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Dimitri Fontaine
Date:
Subject: Re: proposal: set GUC variables for single query
Next
From: Jeff Davis
Date:
Subject: Re: GiST for range types (was Re: Range Types - typo + NULL string constructor)