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 1fY8XJ-0004pk-7J for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Jun 2018 11:22:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fY8XH-0002oV-Ks for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Jun 2018 11:22:55 +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 1fY8XH-0002oO-AP for pgsql-hackers@lists.postgresql.org; Wed, 27 Jun 2018 11:22:55 +0000 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fY8XE-0002KW-2h for pgsql-hackers@lists.postgresql.org; Wed, 27 Jun 2018 11:22:53 +0000 Received: by mail-wm0-x22b.google.com with SMTP id w137-v6so5396800wmw.1 for ; Wed, 27 Jun 2018 04:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=A/4sCDSL5HMM0gQ7GljrYJ+iADK34WGKtpzNGGbZxnU=; b=Jj+Uoq/eIjKXGC8IEGwXYzFAnNum3k0gJjP30USTC7XinJS57BkmcBa7ytHKxJc/79 Q0huURCnxDHuHZWC2Zu8Q4DZ4Snkm9oQMIaqEXM/k7VjGrFaYZ8Vy2mCKNH941E2+64e 0T32UVKNJuWVAHVyM6jCh/XejfAy7rDMjC94dHEJ0PP49qPX57O1XGka5q2PoHVGTll1 FnWVqeaYD4cRn6H3yB07QMA7KO0o9V00n7rZaSJ1WcodS3QduD4QqhvtI3e9c8ueuHoU zg+dFfFivhh/xFZ8pdkEu0RTfdOU5M1UXZMiyPfBhIpvXgVd99ebx1sKlI06VymIJAro UW8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=A/4sCDSL5HMM0gQ7GljrYJ+iADK34WGKtpzNGGbZxnU=; b=ovN+2TgDwavMbz621eIm3yAfAltA9Wev+Xfn3qxbb8G6OFe61DheadetSCuLH9lD+D 4ZR1fziLX7TiO8BSlXu3vR8rCrX+dVuqp9mq4xgjZSlLWXYEGM2G8BmZNLDUw4Z10T1p xQVypWF9lDi/KX7EnyyYT5Ee52hgRBmib+3tohNlFlSHsDoA4JQyrbVp5qPaoK0feylX RXPYQ+RcmVwpXJIJ0JSFS8SDgTJXySQDwFe4g1F9GF+6K1SlXCl4tUi5DSt8hCsGrwPC a5988zsTVr+qyb/NKOiW/RXWNDxnJDVo7d4EqMbuqiU4pWXSw+X8E+fqNltFt+WdnEI2 vOBQ== X-Gm-Message-State: APt69E09kLlQk/qUK8dgZrpiIbVoO+cyUJP1/c32KVE2uA8xRNMQNYtv OIkeYINtPrpbVPefgdqXmimWJwdlRcMEHtZTD6w= X-Google-Smtp-Source: AAOMgpeSsvGpZr2ZrSIn7dRro/XTE1FnMRKKgmJDPK1doAg3qO5A6zjwltgyK/CRj04YOJGAekxoKWKoZXgyu+0CHhc= X-Received: by 2002:a1c:8590:: with SMTP id h138-v6mr4498267wmd.85.1530098570441; Wed, 27 Jun 2018 04:22:50 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:adf:b3c2:0:0:0:0:0 with HTTP; Wed, 27 Jun 2018 04:22:10 -0700 (PDT) In-Reply-To: <28924bcc-9242-9798-e4e8-9d83cea3fef6@dalibo.com> References: <623395617.20171113141500@gf.microolap.com> <28924bcc-9242-9798-e4e8-9d83cea3fef6@dalibo.com> From: Pavel Stehule Date: Wed, 27 Jun 2018 13:22:10 +0200 Message-ID: Subject: Re: [HACKERS] proposal: schema variables To: Gilles Darold Cc: PostgreSQL Hackers Content-Type: multipart/alternative; boundary="000000000000c340bb056f9dd563" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000c340bb056f9dd563 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi 2018-06-27 12:21 GMT+02:00 Gilles Darold : > Hi, > > I'm reviewing the patch as it was flagged in the current commit fest. Her= e > 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 =E2=80=98transformLetStmt=E2=80=99: > analyze.c:1568:17: warning: variable =E2=80=98rte=E2=80=99 set but not us= ed > [-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 c= an > 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. > I plan significant refactoring of this patch for next commitfest. There was anotherstrong Peter's and Robert comments 1. The schema variables should to have own system table 2. The composite schema variables should to use explicitly defined composite type 3. The memory management is not nice - transactional drop table with content is implemented ugly. I hope, so I can start on these issues next month. Thank you for review - I'll recheck ALTER commands. Regards Pavel > > -- > Gilles Darold > Consultant PostgreSQLhttp://dalibo.com - http://dalibo.org > > --000000000000c340bb056f9dd563 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

2018-06-27 12:21 GMT+02:00 Gilles Darold <<= a href=3D"mailto:gilles.darold@dalibo.com" target=3D"_blank">gilles.darold@= dalibo.com>:
=20 =20 =20
Hi,

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

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

=C2=A0- Some compilation warning must be fixed:

analyze.c: In function =E2=80=98transformLetStmt=E2=80=99= :
analyze.c:1568:17: warning: variable =E2=80=98rte=E2=80=99 set but = not used [-Wunused-but-set-variable]
=C2=A0 RangeTblEntry *rte;
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^~~
tab-complete.c:1268:21: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
=C2=A0 {"VARIABLE", NULL, &Query_for_list_of_variable= s},

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

=C2=A0- How about Peter's suggestion?:
=C2=A0=C2=A0=C2=A0 "In DB2, the privileges for variables are nam= ed READ and WRITE. That would make more sense to me than reusing the privilege names for tables.

=C2=A0=C2=A0=C2=A0 The patch use SELECT and UPDATE which make sense t= oo for SELECT but less for UPDATE.

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

=C2=A0- ALTER VARIABLE var1 OWNER TO gilles; ok but not documented an= d missing in regression test

=C2=A0- 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.


I plan significan= t refactoring of this patch for next commitfest. There was anotherstrong Pe= ter's and Robert comments

1. The schema variab= les should to have own system table
2. The composite schema varia= bles should to use explicitly defined composite type
3. The memor= y management is not nice - transactional drop table with content is impleme= nted ugly.

I hope, so I can start on these issues = next month.

Thank you for review - I'll re= check ALTER commands.

Regards

<= /div>
Pavel


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

--000000000000c340bb056f9dd563--