Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eAHcR-0005Cf-JH for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Nov 2017 15:41:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1eAHcR-0004Wc-5t for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Nov 2017 15:41:23 +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.84_2) (envelope-from ) id 1eAHcP-0004Rx-KF for pgsql-hackers@postgresql.org; Thu, 02 Nov 2017 15:41:21 +0000 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1eAHcM-0003Ya-AA for pgsql-hackers@postgresql.org; Thu, 02 Nov 2017 15:41:21 +0000 Received: by mail-wm0-x22b.google.com with SMTP id r196so12008595wmf.2 for ; Thu, 02 Nov 2017 08:41:18 -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=KLsS0nK+0bDlcfNyEpCKbB7l0vUKKAkr8Ue6pebxd7o=; b=GEIOS5MFok8ZGGi1oGNshgel1wogETr+IOtDxdIGemwzlXiIi1DXj2+sx48uKQc/uD aMcDh4uttqz8LF/C7yWtzAUzNIjMO42m9u14q8/nD1Mtb3xLMP1eJFAz5SKb54nJnCtT RR+4cp7SDKx7gXvNt5ZqaVA5Sve2d8w8MDbRUMMf8aCR7l5WZCg+WMfCztX36eZBs9oh ePAMzRY0JCdsWoHUJB+VLp8BWSstE/NWO2n/LcdwRPzhwdfWXcFA/BknSjoo3qDpZFEY QNhJIvlssqoEmT1Z/xRfSUgBJSaF3QrtlbhzLZPjY07ECI1ZNmmf2ICL+WZ09x/GjOeo F43A== 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=KLsS0nK+0bDlcfNyEpCKbB7l0vUKKAkr8Ue6pebxd7o=; b=bVrglG187sTQdIlssPR+Z2d6MDDNwKl29lPFdzWn4zLYNNWsYq/Jdd9v+GaQ3xK0bj ZKoO476FoLLbAAuUVJ8k32OVIIpTb0RAK69z0itl9uPnDCW6M7L5yhQqIptr25snzaYc Io0TbgyAFAORHFkrpNl0vavpxnki18YJZ0rtDjIbndPMW4WBJGYQhIc+oJXof5Y/juKf 01juyiRxecAIKD6z6Rn2o+qpyBtRmrwxUJOW/qJcnCXxW8ZctuB921JqePVDK/sHtaXI c7E8g2zFGQrxexw0N5u23SL7EkMA3nAhzvU1Ak6GonbTaZ1JZhGB5sSxzFmD2SP/H/xb rfKg== X-Gm-Message-State: AMCzsaWME1I7gdVQKa3IDne4hOEMcR5Noxy18kQjgjyc9ASq5YYZyCL9 rCiamSlwUmVhv6JWu77M9dzGQTcypd8FF4hk9Kc= X-Google-Smtp-Source: ABhQp+QO11Rx2TElV/Tut42T/BuTUViFEHCY1Pu8qziO+P7J9xoYhadDuGZWJkMN492ePBBWevgJAMADVyvWtL31dJM= X-Received: by 10.28.218.4 with SMTP id r4mr1945375wmg.97.1509637277344; Thu, 02 Nov 2017 08:41:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.146.7 with HTTP; Thu, 2 Nov 2017 08:40:36 -0700 (PDT) In-Reply-To: <20171102153505.GP4496@localhost> References: <20171102153505.GP4496@localhost> From: Pavel Stehule Date: Thu, 2 Nov 2017 16:40:36 +0100 Message-ID: Subject: Re: proposal: schema variables To: Nico Williams Cc: Robert Haas , PostgreSQL Hackers Content-Type: multipart/alternative; boundary="001a1145ac7aa7e94a055d01d154" List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --001a1145ac7aa7e94a055d01d154 Content-Type: text/plain; charset="UTF-8" 2017-11-02 16:35 GMT+01:00 Nico Williams : > On Thu, Nov 02, 2017 at 06:05:54PM +0530, Robert Haas wrote: > > On Thu, Oct 26, 2017 at 12:51 PM, Pavel Stehule > wrote: > > > The variables can be modified by SQL command SET (this is taken from > > > standard, and it natural) > > > > > > SET varname = expression; > > > > Overloading SET to handle both variables and GUCs seems likely to > > create problems, possibly including security problems. For example, > > maybe a security-definer function could leave behind variables to > > trick the calling code into failing to set GUCs that it intended to > > set. Or maybe creating a variable at the wrong time will just break > > things randomly. > > That's already true of GUCs, since there are no access controls on > set_config()/current_setting(). > > Presumably "schema variables" would really just be GUC-like and not at > all like lexically scoped variables. And also subject to access > controls, thus an overall improvement on set_config()/current_setting(). > > With access controls, GUCs could become schema variables, and settings > from postgresql.conf could move into the database itself (which I think > would be nice). > I am sorry, but I don't plan it. the behave of GUC is too different than behave of variables. But I am planning so system GUC can be "moved" to pg_catalog to be possibility to specify any object exactly. Regards Pavel > > Nico > -- > --001a1145ac7aa7e94a055d01d154 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


2017-11-02 16:35 GMT+01:00 Nico Williams <nico@cryptonector.com>:
On Thu, N= ov 02, 2017 at 06:05:54PM +0530, Robert Haas wrote:
> On Thu, Oct 26, 2017 at 12:51 PM, Pavel Stehule <
pavel.stehule@gmail.com> wrote:
> > The variables can be modified by SQL command SET (this is taken f= rom
> > standard, and it natural)
> >
> > SET varname =3D expression;
>
> Overloading SET to handle both variables and GUCs seems likely to
> create problems, possibly including security problems.=C2=A0 For examp= le,
> maybe a security-definer function could leave behind variables to
> trick the calling code into failing to set GUCs that it intended to > set.=C2=A0 Or maybe creating a variable at the wrong time will just br= eak
> things randomly.

That's already true of GUCs, since there are no access controls = on
set_config()/current_setting().

Presumably "schema variables" would really just be GUC-like and n= ot at
all like lexically scoped variables.=C2=A0 And also subject to access
controls, thus an overall improvement on set_config()/current_setting().

With access controls, GUCs could become schema variables, and settings
from postgresql.conf could move into the database itself (which I think
would be nice).

I am sorry, but I don&#= 39;t plan it. the behave of GUC is too different than behave of variables. = But I am planning so system GUC can be "moved" to pg_catalog to b= e possibility to specify any object exactly.

Regar= ds

Pavel

Nico
--

--001a1145ac7aa7e94a055d01d154--