Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gycAR-00033q-8q for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Feb 2019 12:49:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gycAN-0007uu-Kw for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Feb 2019 12:48:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gycAN-0007um-DL for pgsql-hackers@lists.postgresql.org; Tue, 26 Feb 2019 12:48:59 +0000 Received: from forward102o.mail.yandex.net ([37.140.190.182]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gycAG-0000UW-02 for pgsql-hackers@postgreSQL.org; Tue, 26 Feb 2019 12:48:58 +0000 Received: from mxback12o.mail.yandex.net (mxback12o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::63]) by forward102o.mail.yandex.net (Yandex) with ESMTP id 3015266812D8 for ; Tue, 26 Feb 2019 15:48:49 +0300 (MSK) Received: from smtp4p.mail.yandex.net (smtp4p.mail.yandex.net [2a02:6b8:0:1402::15:6]) by mxback12o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 0sskWWJB8O-mnguBTJo; Tue, 26 Feb 2019 15:48:49 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1551185329; bh=mzeJeDHPFLNTq9g3U5AVPkq0pAXeRMgZuHF9c8m+qaI=; h=In-Reply-To:Subject:To:From:References:Date:Message-ID; b=f8PyCiJ5xBAy9G5cVPp4VdcDgNGQf4OK5+WAA8ZBRVjoqtTruI3oqkEGRySjV6t6o 7yZXnshdOzOxTmE0WMGMGoAZsAsXb0XRzRI12WBDfRFVw0wd2TlCQRjs4o03M+r3yb v+oZJaxpasnywvF+yKqvYF9dPan2dWoghn9mcclo= Authentication-Results: mxback12o.mail.yandex.net; dkim=pass header.i=@yandex.ru Received: by smtp4p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id o1FuUfwvcm-mlDSVFRY; Tue, 26 Feb 2019 15:48:48 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) Date: Tue, 26 Feb 2019 14:48:46 +0200 From: Eugen Konkov Message-ID: <251485831.20190226144846@yandex.ru> To: PostgreSQL-development Subject: Re: BUG #15646: Inconsistent behavior for current_setting/set_config In-Reply-To: <356428520.20190226143539@yandex.ru> References: <15646-0d3caee9f6266f60@postgresql.org> <16698.1550682675@sss.pgh.pa.us> <2247b773-fe5a-c08a-5655-5dff35be2954@joeconway.com> <356428520.20190226143539@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello Documentation has no description how 'false' value for 'is_local' parameter interact with transaction Do I understand correct? https://www.postgresql.org/docs/11/functions-admin.html#FUNCTIONS-ADMIN-SET >set_config sets the parameter setting_name to new_value. If is_local is true, the new value will only apply to the current transaction. If you want the new value to apply for the current session, use false instead. If I use 'false' then transaction will not have effect, because I set the value to session? tucha=> select current_setting( 'my.app_period', true ); current_setting ----------------- (1 row) tucha=> begin; BEGIN tucha=> select set_config( 'my.app_period', tstzrange( '-infinity', 'infinity' )::text, false ); set_config ---------------------- [-infinity,infinity) (1 row) tucha=> rollback; ROLLBACK NOTICE: session is rolled back and session value is rolled back despite on that I did not use 'true' as parameter for local: tucha=> select current_setting( 'my.app_period', true ); current_setting ----------------- (1 row) tucha=> begin; BEGIN tucha=> select set_config( 'my.app_period', tstzrange( '-infinity', 'infinity' )::text, false ); set_config ---------------------- [-infinity,infinity) (1 row) tucha=> commit; COMMIT When I commit then the value is applied to session: tucha=> select current_setting( 'my.app_period', true ); current_setting ---------------------- [-infinity,infinity) (1 row) -- Best regards, Eugen Konkov