Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l1RIw-0002yj-Ix for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Jan 2021 09:58:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l1RIv-0006wW-Gr for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Jan 2021 09:58:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l1RIv-0006wN-6G for pgsql-hackers@lists.postgresql.org; Mon, 18 Jan 2021 09:58:33 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l1RIs-0000SY-Ls for pgsql-hackers@lists.postgresql.org; Mon, 18 Jan 2021 09:58:32 +0000 Received: by mail-pj1-x1034.google.com with SMTP id u4so9443546pjn.4 for ; Mon, 18 Jan 2021 01:58:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WmzP7PXshoaFr8lGndSuY2SLsKNSlN6TpkwpdctjfmY=; b=vHDJpoPZXK5K2ysSET5qG4m9GRnsSretpcY/r1ONsDYU6f4QasvqvJvTnsgyRZMI0b 7dEwAIzTd/aaTFwvkEkgjtm5Q8TjH9owmm7TUkpb1iOG72mNQ7L2x2XtuBHjzD9vOOUh w4s1o6QTgpcCtGQ3dlwVFNGT/hCsohKVNCz6lbfC9PDQmN4eW9BXzxTAM93WUd3A3yg1 +cAPrXbvduPRMYFVkFCD3Pbq8nzHuj2dt0yvI8jqKUVf3qiv/yqSJD6hgRMYM+T2w0Lz VnOksx8410nRYfQXceRnSfvbygaJq0Z36Q2MIEYYLFexJpQUXrV2ikpV8ZeMW6CdYyXO ytAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WmzP7PXshoaFr8lGndSuY2SLsKNSlN6TpkwpdctjfmY=; b=gCMn39HEb77skSsccwx7C+JhpiKFS8Cwgz/OzOETz2BFknex1uDUZOrdRybF20wOKW h0ujIRca7N/z4+DCxoP7WN3zwlJJ7rzt3tW3VNWmKrjGbpOe0hjMozemg2wt69mo7cyx FGduyHZBx6ghiVx/z50tZ1QzELXeX119mBqpUEMsElQ4qWoYJPfjO3C6I+ibarMkWff6 yw6clAG9tsxAugY7PGJU2UEeDDAlFxGO6xoU1K1i7iNM35psfJbUom3/ebqxqozrZrax H1jJB5Ja7NMZK+kQB0O1s5dbu247lTvlJxZABX9yhvUkI1sK5T90S/XH5tKgOclBWcVM SDrg== X-Gm-Message-State: AOAM531ZooPZ9FxH/5fteBmZtLzMikZFZqr2ItlwJw2xC1IIQH9Ea6Vp /kUuuhFmwJXJ7WmIEpT41Pxkr8hSn/JPBvndk4g= X-Google-Smtp-Source: ABdhPJy+izA5Wrn1D0npo0NnJTbzXOJLybuJzJhx6HIEYWdEU5StXrofHiaDGTTj2peqNX+vZTB8FFjTUCqtU3FHaQc= X-Received: by 2002:a17:90a:5d8d:: with SMTP id t13mr25747299pji.39.1610963908520; Mon, 18 Jan 2021 01:58:28 -0800 (PST) MIME-Version: 1.0 References: <20200924035637.GF28585@paquier.xyz> <20201001033824.GC8130@paquier.xyz> <51a9a68e8a998d04df17417d45c1dbd4@xs4all.nl> In-Reply-To: From: Pavel Stehule Date: Mon, 18 Jan 2021 10:57:51 +0100 Message-ID: Subject: Re: proposal: schema variables To: =?UTF-8?B?Sm9zZWYgxaBpbcOhbmVr?= Cc: Erik Rijkers , Michael Paquier , Zhihong Yu , Amit Kapila , DUVAL REMI , PostgreSQL Hackers Content-Type: multipart/alternative; boundary="000000000000836c2a05b929c38a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000836c2a05b929c38a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi =C4=8Dt 14. 1. 2021 v 11:31 odes=C3=ADlatel Josef =C5=A0im=C3=A1nek napsal: > I did some testing locally. All runs smoothly, compiled without warning. > > Later on (once merged) it would be nice to write down a documentation > page for the whole feature as a set next to documented individual > commands. > It took me a few moments to understand how this works. > > I was looking how to create variable with non default value in one > command, but if I understand it correctly, that's not the purpose. > Variable lives in a schema with default value, but you can set it per > session via LET. > > Thus "CREATE VARIABLE" statement should not be usually part of > "classic" queries, but it should be threatened more like TABLE or > other DDL statements. > > On the other side LET is there to use the variable in "classic" queries. > > Does that make sense? Feel free to ping me if any help with > documentation would be needed. I can try to prepare an initial > variables guide once I'll ensure I do understand this feature well. > I invite any help with doc. Maybe there can be page in section advanced features https://www.postgresql.org/docs/current/tutorial-advanced.html Regards Pavel > > PS: Now it is clear to me why it is called "schema variables", not > "session variables". > > =C4=8Dt 14. 1. 2021 v 7:36 odes=C3=ADlatel Pavel Stehule > napsal: > > > > Hi > > > > rebase > > > > Regards > > > > Pavel > > > --000000000000836c2a05b929c38a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

=C4=8Dt 14. 1. 2021 v=C2=A011:31 odes=C3=ADla= tel Josef =C5=A0im=C3=A1nek <= josef.simanek@gmail.com> napsal:
I did some testing locally. All runs smoothly, comp= iled without warning.

Later on (once merged) it would be nice to write down a documentation
page for the whole feature as a set next to documented individual
commands.
It took me a few moments to understand how this works.

I was looking how to create variable with non default value in one
command, but if I understand it correctly, that's not the purpose.
Variable lives in a schema with default value, but you can set it per
session via LET.

Thus "CREATE VARIABLE" statement should not be usually part of "classic" queries, but it should be threatened more like TABLE or=
other DDL statements.

On the other side LET is there to use the variable in "classic" q= ueries.

Does that make sense? Feel free to ping me if any help with
documentation would be needed. I can try to prepare an initial
variables guide once I'll ensure I do=C2=A0 understand this feature wel= l.

I invite any help with doc. Maybe th= ere can be page in section advanced features

Regards

Pavel
=C2=A0

PS: Now it is clear to me why it is called "schema variables", no= t
"session variables".

=C4=8Dt 14. 1. 2021 v 7:36 odes=C3=ADlatel Pavel Stehule <pavel.stehule@gmail.com&= gt; napsal:
>
> Hi
>
> rebase
>
> Regards
>
> Pavel
>
--000000000000836c2a05b929c38a--