Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g2aZg-0000dX-HB for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Sep 2018 11:23:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g2aZe-0001NE-7T for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Sep 2018 11:23:14 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1g2aZd-0001Mv-Rd for pgsql-hackers@lists.postgresql.org; Wed, 19 Sep 2018 11:23:14 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g2aZZ-00043g-Se for pgsql-hackers@lists.postgresql.org; Wed, 19 Sep 2018 11:23:13 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id CEB6221C27FE; Wed, 19 Sep 2018 14:23:07 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from zakirov.localdomain (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 8F19421C245D; Wed, 19 Sep 2018 14:23:07 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1537356187; bh=oLTwS8Mw+E92CSoGVdJ2IDWrM8A95zoBWeqSDEoikvI=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=E0LTPZOsK1+cyEGL2UJDrJ/f8ZMSND3zLGy6cCrGaKaWJr1O3r+vNDwUZeAjoPbjd miBzqRX3kkklgV7zOh72rn0Ji0wU/hTCmOzBkTttOXfRyfAlWWGXOZSMVARXBHINrG ChmjgVz1rfEGYDxxZRzaW0Vaz7cCjtCiESIJDiyc= Date: Wed, 19 Sep 2018 14:23:06 +0300 From: Arthur Zakirov To: Pavel Stehule Cc: Dean Rasheed , Fabien COELHO , Gilles Darold , PostgreSQL Hackers Subject: Re: [HACKERS] proposal: schema variables Message-ID: <20180919112305.GA18604@zakirov.localdomain> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, On Wed, Sep 19, 2018 at 10:30:31AM +0200, Pavel Stehule wrote: > Hi > > new update: > > I fixed pg_restore, and I cleaned a code related to transaction processing > > There should be a full functionality now. I reviewed a little bit the patch. I have a few comments. > <structname>pg_views</structname> Columns I think there is a typo here. It should be "pg_variable". > GRANT { READ | WRITE | ALL [ PRIVILEGES ] } Shouldn't we use here GRANT { SELECT | LET | ... } syntax for the constistency. Same for REVOKE. I'm not experienced syntax developer though. But we use SELECT and LET commands when working with variables. So we should GRANT and REVOKE priveleges for this commands. > [ { ON COMMIT DROP | ON TRANSACTION END RESET } ] I think we may join them and have the syntax { ON COMMIT DROP | RESET } to get more simpler syntax. If we create a variable with ON COMMIT DROP, PostgreSQL will drop it regardless of whether transaction was committed or rollbacked: =# ... =# begin; =# create variable int1 int on commit drop; =# rollback; =# -- There is no variable int1 CREATE TABLE syntax has similar options [1]. ON COMMIT controls the behaviour of temporary tables at the end a transaction block, whether it was committed or rollbacked. But I'm not sure is this a good example of precedence. > - ONCOMMIT_DROP /* ON COMMIT DROP */ > + ONCOMMIT_DROP, /* ON COMMIT DROP */ > } OnCommitAction; There is the extra comma here after ONCOMMIT_DROP. 1 - https://www.postgresql.org/docs/current/static/sql-createtable.html -- Arthur Zakirov Postgres Professional: http://www.postgrespro.com Russian Postgres Company