Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bX6o1-0002IL-2F for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Aug 2016 13:10:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bX6o0-0007JT-Kn for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Aug 2016 13:10:52 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bX6nM-0006ZI-Gu for pgsql-bugs@postgresql.org; Tue, 09 Aug 2016 13:10:12 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bX6nG-0003Vk-DP for pgsql-bugs@postgresql.org; Tue, 09 Aug 2016 13:10:11 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 68B132042C; Tue, 9 Aug 2016 09:10:05 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Tue, 09 Aug 2016 09:10:05 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=+SPwsIPM09j+MsM Worv9ve3awPI=; b=IeO/PGstwk9yqNGmj9UJuVDukCKbtLFugH0V2ghAysGcuNy 2CFuHcuaR4Ia4z4WB0b8KIzrzA5GWswAl9Fjc7YRdfZK2akFw9Oc4a0yW4gDHRMO 5dawgGV6qg4dZTusFBT3iED/aZpaW4sqTJeegwDsSHU5oAMT13leE6bdYoPo= X-Sasl-enc: QoGtMW/ASQHNw9ZCX0CorCUDuuq1a+1HVKTy+iFLlmL4 1470748205 Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id 10650CCD26; Tue, 9 Aug 2016 09:10:05 -0400 (EDT) Subject: Re: 9.5 Create Function Set From Current taken at creation time? To: "David G. Johnston" , "pgsql-bugs@postgresql.org" References: From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <8cee0868-4d5c-beab-ea5d-82b8158d6e6b@2ndquadrant.com> Date: Tue, 9 Aug 2016 09:10:04 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 8/8/16 5:46 PM, David G. Johnston wrote: > """ > The SET clause causes the specified configuration parameter to be set to > the specified value when the function is entered, and then restored to > its prior value when the function exits. SET FROM CURRENT saves the > session's current value of the parameter as the value to be applied when > the function is entered. > """ > > https://www.postgresql.org/docs/current/static/sql-createfunction.html > > I expect the attached script to output "NOTICE: SP : thirdschema", > instead it outputs "NOTICE: SP: otherschema" I think the piece you are missing is that it saves the setting when the function is created, not when it is run. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs