Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tDyU1-004Mq6-B7 for pgsql-hackers@arkaria.postgresql.org; Thu, 21 Nov 2024 04:07:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tDyU0-00C2qU-2I for pgsql-hackers@arkaria.postgresql.org; Thu, 21 Nov 2024 04:07:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tDyTz-00C2qM-OO for pgsql-hackers@lists.postgresql.org; Thu, 21 Nov 2024 04:07:55 +0000 Received: from mail-yb1-xb35.google.com ([2607:f8b0:4864:20::b35]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tDyTt-0032mw-OK for pgsql-hackers@lists.postgresql.org; Thu, 21 Nov 2024 04:07:54 +0000 Received: by mail-yb1-xb35.google.com with SMTP id 3f1490d57ef6-e3890093c13so480447276.1 for ; Wed, 20 Nov 2024 20:07:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732162068; x=1732766868; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=f8dDmjy2zkgkSTs5+7Pn6nLk4Hs8l4pJtFyoMJrkNPg=; b=iYr/HGAsDjsHWcD1z47KRMTpuwwWt9Z3KWxJoUuRAwqN0yqFAD2GmOAVa2Mi/sT/kr NSpLu05pCd1FzyOFCqJgtux7uwdvUkItCTSmiKicnAd7Hjgs9wS2Zbwqyzi1zRS40Uj7 OhIi0ue9GQa9ok7vT5M8Fx3L5cYh1BbTT0Ta8npcBUeOiHUb4cemylUNGdck4ze4CWHm imLqboapVfIVC/eWkcVYX2UgFMqc7AjlcNGDUSYRfrHwkFSxj9qnPhShrpIesW7Atc1h s1XwSJdedh2MYmRIno34r+hBV9BXB+zlwDINw2UoQIB92l7rkLEpC3ENCbnxuzyUCUPD WTJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732162068; x=1732766868; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=f8dDmjy2zkgkSTs5+7Pn6nLk4Hs8l4pJtFyoMJrkNPg=; b=ixhetS2jzUo1GCQLa3y2K7/xCJWGNxNrDS5/nqDJMx3BJlXb9BR5ui18uoqQ4/F6H7 FizNowO6ZMERqdqAVp1L/xFUWpuclGOiSqtoQyl6TOXCkGcLnkvMaGkrUX8B/CQHv2AZ yMha272AWyvooqeSLFs1+iqHDacqm4LQnDirVVKyeE1Yz3YWB31hZsR17uB2cWpxqtmC r9oaiOvVd1pCDodVoB9yGV5Pdf/p3tnI304qc+XW5dTZkzxE3z7/wUOuZXskBa2m56Y3 oNTHolksl+nVaiqucKLtE658uyY7Daz6NnfxscSialtBQe8b0kQrK18FRfTD9byokNsa 4t1g== X-Forwarded-Encrypted: i=1; AJvYcCVbXYT+ji1QEp96saYKYWNx5aHRpRpVabds3/k9cYmWDlq3z/TujuNCusqmVXh7tDSe04wc0VKhFor9LzB2@lists.postgresql.org X-Gm-Message-State: AOJu0Yw/CDhbqkM0jPd0loUbRcYzJrnJdxNRbur3RhJY0u6j6qjl3tOt LTlILHjayrFLQA+HXEO3Ujgm88y2ud36X4L2FO4NiF5OzA41mAlRwwDFOxxdcUD7flDADCUogpO gF3b9hY9VsmuXA/9gqf1Q36j5uUA= X-Gm-Gg: ASbGncvWFoPrhEjgCjAfMfxFaDdZWcryXZXIK1hUXtilB/6GxcRad4Htbih5QN4X04Z Z9iKgxaE8UR87AUAx64ZtO8PJLK1dR0uczlypWFN2Oqs3YSpU4mCZVJToX9MWzdgx X-Google-Smtp-Source: AGHT+IHH6YrX06/zRkJ73++u/sYXfvZ5Qb9mw2nWU7zPoCVOgjzWR56ctKBOtTrsmDv3NOamCNS1Ww6TwxOfG/Y+YSU= X-Received: by 2002:a05:6902:2209:b0:e35:dede:fe02 with SMTP id 3f1490d57ef6-e38cb70abe9mr5448270276.44.1732162068032; Wed, 20 Nov 2024 20:07:48 -0800 (PST) MIME-Version: 1.0 References: <3chredgnjcmccym2kczawfih226b4ac6co7p6z4jeofevrcosi@mrsxkx2x2c65> <20241120201313.t4wbhld4ktgielaf@erthalion.local> In-Reply-To: <20241120201313.t4wbhld4ktgielaf@erthalion.local> From: Pavel Stehule Date: Thu, 21 Nov 2024 05:07:09 +0100 Message-ID: Subject: Re: proposal: schema variables To: Dmitry Dolgov <9erthalion6@gmail.com> Cc: Laurenz Albe , Erik Rijkers , Michael Paquier , Amit Kapila , DUVAL REMI , PostgreSQL Hackers Content-Type: multipart/alternative; boundary="000000000000c233d2062764680b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000c233d2062764680b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable st 20. 11. 2024 v 21:14 odes=C3=ADlatel Dmitry Dolgov <9erthalion6@gmail.co= m> napsal: > > On Tue, Nov 19, 2024 at 08:14:01PM +0100, Pavel Stehule wrote: > > Hi > > > > I wrote POC of VARIABLE(varname) syntax support > > Thanks, the results look good. I'm still opposed the idea of having a > warning, and think it has to be an error -- but it's my subjective > opinion. Lets see if there are more votes on that topic. > The error breaks the possibility to use variables (session variables) like Oracle's package variables easily. It increases effort for transformation or porting because you should identify variables inside queries and you should wrap it to fence. On the other hand, extensions that can read a query after transformation can easily detect unwrapped variables and they can raise an error. It can be very easy to implement this check to plpgsql_check for example or like plpgsql.extra_check. In my ideal world, the shadowing warning should be enabled by default, and an unfencing warning disabled by default. But I have not a problem with activating both warnings by default. I think warnings are enough, because if there is some risk then a shadowing warning is activated. And my experience is more positive about warnings, people read it. Regards Pavel --000000000000c233d2062764680b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
st 20. 11. 2024 v=C2=A021:14 odes=C3= =ADlatel Dmitry Dolgov <9erthal= ion6@gmail.com> napsal:
> On Tue, Nov 19, 2024 at 08:14:01PM +0100, Pavel Stehule= wrote:
> Hi
>
> I wrote POC of VARIABLE(varname) syntax support

Thanks, the results look good. I'm still opposed the idea of having a warning, and think it has to be an error -- but it's my subjective
opinion. Lets see if there are more votes on that topic.

The error breaks the possibility to use variables (sessio= n variables) like Oracle's package variables easily. It increases effor= t for transformation or porting because you should identify variables insid= e queries and you should wrap it to fence.=C2=A0 On the other hand, extensi= ons that can read a query after transformation can easily detect unwrapped = variables and they can raise an error. It can be very easy to implement thi= s check to plpgsql_check for example or like plpgsql.extra_check.

In my ideal world, the shadowing warning should be ena= bled by default, and an unfencing warning disabled by default. But I have n= ot a problem with activating both warnings by default. I think warnings=C2= =A0 are enough, because if there is some risk then a shadowing warning is a= ctivated. And my experience is more positive about warnings, people read it= .

Regards

Pavel
=


--000000000000c233d2062764680b--