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 1fY7Zs-0001Cl-DY for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Jun 2018 10:21:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fY7Zq-00089R-FB for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Jun 2018 10:21:30 +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.89) (envelope-from ) id 1fY7Zq-00088m-2Z for pgsql-hackers@lists.postgresql.org; Wed, 27 Jun 2018 10:21:30 +0000 Received: from mimolette.dalibo.net ([212.85.157.144] helo=mail.dalibo.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fY7Zm-0000uE-Nx for pgsql-hackers@lists.postgresql.org; Wed, 27 Jun 2018 10:21:28 +0000 Received: from [192.168.1.21] (AGrenoble-653-1-42-9.w92-129.abo.wanadoo.fr [92.129.130.9]) by mail.dalibo.com (Postfix) with ESMTPSA id 81E822C0423; Wed, 27 Jun 2018 12:21:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1530094882; bh=FVxI3Wbod0C3a0xYQypxIqKbg4iTBA3phlFHIXJc6qc=; h=Subject:To:References:From:Date:In-Reply-To:From; b=hobLtqOBQ6CGDEJPlB5cRMF0VhVAhHjrH6+MuXpzTF7cRQljtafh64oUMp4qC1O34 VoVhsIKtAN/rV9Sh7Oed63GodR55VYMbIp7HuMpr/3BicErVYaA+ptEl0bMQ50pIN5 ueeqGZvGY34WNPNcMwlQ6r0MFr1W5NbU3ZmTkDa0= Subject: Re: [HACKERS] proposal: schema variables To: pgsql-hackers@lists.postgresql.org, Pavel Stehule References: <623395617.20171113141500@gf.microolap.com> From: Gilles Darold Message-ID: <28924bcc-9242-9798-e4e8-9d83cea3fef6@dalibo.com> Date: Wed, 27 Jun 2018 12:21:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------C15DAB3ECEAED6192133E1D8" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------C15DAB3ECEAED6192133E1D8 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi, I'm reviewing the patch as it was flagged in the current commit fest. Here are my feedback:  - The patch need to be rebased due to changes in file src/sgml/catalogs.sgml  - Some compilation warning must be fixed: analyze.c: In function ‘transformLetStmt’: analyze.c:1568:17: warning: variable ‘rte’ set but not used [-Wunused-but-set-variable]   RangeTblEntry *rte;                  ^~~ tab-complete.c:1268:21: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]   {"VARIABLE", NULL, &Query_for_list_of_variables}, In the last warning a NULL is missing, should be written: {"VARIABLE", NULL, NULL, &Query_for_list_of_variables},  - How about Peter's suggestion?:     "In DB2, the privileges for variables are named READ and WRITE. That would make more sense to me than reusing the privilege names for tables.     The patch use SELECT and UPDATE which make sense too for SELECT but less for UPDATE.  - The implementation of "ALTER VARIABLE varname SET SCHEMA schema_name;" is missing  - ALTER VARIABLE var1 OWNER TO gilles; ok but not documented and missing in regression test  - ALTER VARIABLE var1 RENAME TO var2; ok but not documented and missing in regression test More generally I think that some comments must be rewritten, especially those talking about a PoC. In documentation there is HTML comments that can be removed. Comment at end of file src/backend/commands/schemavar.c generate some "indent with spaces" errors with git apply but perhaps the comment can be entirely removed or undocumented details moved to the right place. Otherwise all regression tests passed without issue and especially your new regression tests about schema variables. I have a patch rebased, let me known if you want me to post the new diff. -- Gilles Darold Consultant PostgreSQL http://dalibo.com - http://dalibo.org --------------C15DAB3ECEAED6192133E1D8 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
Hi,

I'm reviewing the patch as it was flagged in the current commit fest. Here are my feedback:

 - The patch need to be rebased due to changes in file src/sgml/catalogs.sgml

 - Some compilation warning must be fixed:

analyze.c: In function ‘transformLetStmt’:
analyze.c:1568:17: warning: variable ‘rte’ set but not used [-Wunused-but-set-variable]
  RangeTblEntry *rte;
                 ^~~
tab-complete.c:1268:21: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
  {"VARIABLE", NULL, &Query_for_list_of_variables},

In the last warning a NULL is missing, should be written: {"VARIABLE", NULL, NULL, &Query_for_list_of_variables},

 - How about Peter's suggestion?:
    "In DB2, the privileges for variables are named READ and WRITE. That would make more sense to me than reusing the privilege names for tables.
    The patch use SELECT and UPDATE which make sense too for SELECT but less for UPDATE.

 - The implementation of "ALTER VARIABLE varname SET SCHEMA schema_name;" is missing

 - ALTER VARIABLE var1 OWNER TO gilles; ok but not documented and missing in regression test

 - ALTER VARIABLE var1 RENAME TO var2; ok but not documented and missing in regression test

More generally I think that some comments must be rewritten, especially those talking about a PoC. In documentation there is HTML comments that can be removed.

Comment at end of file src/backend/commands/schemavar.c generate some "indent with spaces" errors with git apply but perhaps the comment can be entirely removed or undocumented details moved to the right place.

Otherwise all regression tests passed without issue and especially your new regression tests about schema variables.

I have a patch rebased, let me known if you want me to post the new diff.


-- 
Gilles Darold
Consultant PostgreSQL
http://dalibo.com - http://dalibo.org
--------------C15DAB3ECEAED6192133E1D8--