pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Erik Rijkers <er@xs4all.nl>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Zhihong Yu <zyu@yugabyte.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: DUVAL REMI <REMI.DUVAL@cheops.fr>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: proposal: schema variables
Date: Fri, 08 Jan 2021 18:54:55 +0100
Message-ID: <bdeb7611c6dbf22226c302bcc01d178b@xs4all.nl> (raw)
In-Reply-To: <CAFj8pRD+QiWOoPrFk2NnPs3t5Eaf4X=aGRV-9ww11cnPP+fV4g@mail.gmail.com>
References: <CAFj8pRBoGBKopkiTa4ki3dMgy-cSTRZ-BQPKOq7=Tk0SSNsowA@mail.gmail.com>
	<CAFj8pRBCiWn12H9FHymYs17fk68nRd9Xpn+SYf18TLdb2YSUrQ@mail.gmail.com>
	<CAA4eK1JV-Ox0oRFdXnPqXSzM84wTR5QFkRzCpNVF_+0FNjS5Mg@mail.gmail.com>
	<CAFj8pRByCCcgDkeXyafAnH6LgxtAyCVwg6yfJAhyTY6GLscfZg@mail.gmail.com>
	<CAFj8pRBvUonC_ug3F=w1Q55Dp=DggojvAeL7Vmh14Q-WhFHxzw@mail.gmail.com>
	<CAFj8pRDj72P-f=SUygtOXnTOBQ0RzmL_fN=wLfaCzcbPVpGgzw@mail.gmail.com>
	<CAFj8pRDD2GQaJ_iDT4vSVe658+oHRXU2S2af7Y1-it9jaP8VFg@mail.gmail.com>
	<20200924035637.GF28585@paquier.xyz>
	<CAFj8pRAFktynx5wkanv5SRuzXkZgXu77XpVACiSE=v7i1xHFbw@mail.gmail.com>
	<CAFj8pRA=bn_g5T2AZduy5gNOQoOnUJ+pMHmnRMHi6mR0n=TAsA@mail.gmail.com>
	<20201001033824.GC8130@paquier.xyz>
	<CAFj8pRC9de05HSb4tEHDUwJ98+4Wh30W-rJrNOPnTz6ARcv0Fw@mail.gmail.com>
	<CAFj8pRBC5Wz1xHKKBmKsM0xYN0+PdSZ5oXPsk5SZt+VprdUW3A@mail.gmail.com>
	<CAFj8pRAh4pzMoZrKCLt9h+Lr2L=vhgs2PjAF45uLbp_7sijM5w@mail.gmail.com>
	<CAFj8pRA-kxQ1oErcuDeUKYsrgwB5XGLhquatwxOe3dCVy1gcyQ@mail.gmail.com>
	<51a9a68e8a998d04df17417d45c1dbd4@xs4all.nl>
	<CAFj8pRBbt2xhY9PyabOY0ZN+Aig6ee3oCon-DM9qi0Uw_3qfbw@mail.gmail.com>
	<CAFj8pRDSa52J7kPmCYXgq1BBbu3YBXwpdSOVpjgU=hnE2k04Cw@mail.gmail.com>
	<CAFj8pRD+QiWOoPrFk2NnPs3t5Eaf4X=aGRV-9ww11cnPP+fV4g@mail.gmail.com>

On 2021-01-08 07:20, Pavel Stehule wrote:
> Hi
> 
> just rebase
> 
> [schema-variables-20200108.patch]

Hey Pavel,

My gcc 8.3.0 compile says:
(on debian 10/Buster)

utility.c: In function ‘CreateCommandTag’:
utility.c:2332:8: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
     tag = CMDTAG_SELECT;
     ~~~~^~~~~~~~~~~~~~~
utility.c:2334:3: note: here
    case T_LetStmt:
    ^~~~


compile, check, check-world, runs without further problem.

I also changed a few typos/improvements in the documentation, see 
attached.

One thing I wasn't sure of: I have assumed that
   ON TRANSACTIONAL END RESET

should be
   ON TRANSACTION END RESET

and changed it accordingly, please double-check.


Erik Rijkers

Attachments: download all (5 files, .tar.gz)

create_variable.sgml.20210108.diff (text/x-diff, 4.6K) download --- doc/src/sgml/ref/create_variable.sgml.orig 2021-01-08 17:40:20.181823036 +0100 +++ doc/src/sgml/ref/create_variable.sgml 2021-01-08 17:59:46.976127524 +0100 @@ -16,7 +16,7 @@ <refnamediv> <refname>CREATE VARIABLE</refname> - <refpurpose>define a new permissioned typed schema variable</refpurpose> + <refpurpose>define a schema variable</refpurpose> </refnamediv> <refsynopsisdiv> @@ -29,24 +29,24 @@ <title>Description</title> <para> - The <command>CREATE VARIABLE</command> command creates a new schema variable. + The <command>CREATE VARIABLE</command> command creates a schema variable. Schema variables, like relations, exist within a schema and their access is controlled via <command>GRANT</command> and <command>REVOKE</command> commands. - Their changes are non-transactional by default. + Changing a schema variable is non-transactional by default. </para> <para> The value of a schema variable is local to the current session. Retrieving a variable's value returns either a NULL or a default value, unless its value is set to something else in the current session with a LET command. By default, - the content of variable is not transactional, alike regular variables in PL languages. + the content of a variable is not transactional. This is the same as in regular variables in PL languages. </para> <para> - Schema variables are retrieved by the regular <command>SELECT</command> SQL command. - Their value can be set with the <command>LET</command> SQL command. - Notably, while schema variables share properties with tables, they cannot be updated - with <command>UPDATE</command> commands. + Schema variables are retrieved by the <command>SELECT</command> SQL command. + Their value is set with the <command>LET</command> SQL command. + While schema variables share properties with tables, their value cannot be updated + with an <command>UPDATE</command> command. </para> </refsect1> @@ -76,7 +76,7 @@ <term><replaceable class="parameter">name</replaceable></term> <listitem> <para> - The name (optionally schema-qualified) of the variable to create. + The name, optionally schema-qualified, of the variable. </para> </listitem> </varlistentry> @@ -85,7 +85,7 @@ <term><replaceable class="parameter">data_type</replaceable></term> <listitem> <para> - The name (optionally schema-qualified) of the data type of the variable to be created. + The name, optionally schema-qualified, of the data type of the variable. </para> </listitem> </varlistentry> @@ -105,7 +105,7 @@ <term><literal>NOT NULL</literal></term> <listitem> <para> - The <literal>NOT NULL</literal> clause forbid to set the variable to + The <literal>NOT NULL</literal> clause forbids to set the variable to a null value. A variable created as NOT NULL and without an explicitly declared default value cannot be read until it is initialized by a LET command. This obliges the user to explicitly initialize the variable @@ -118,22 +118,22 @@ <term><literal>DEFAULT <replaceable>default_expr</replaceable></literal></term> <listitem> <para> - The <literal>DEFAULT</literal> clause assigns a default data to - schema variable. + The <literal>DEFAULT</literal> clause can be used to assign a default value to + a schema variable. </para> </listitem> </varlistentry> <varlistentry> - <term><literal>ON COMMIT DROP</literal>, <literal>ON TRANSACTIONAL END RESET</literal></term> + <term><literal>ON COMMIT DROP</literal>, <literal>ON TRANSACTION END RESET</literal></term> <listitem> <para> The <literal>ON COMMIT DROP</literal> clause specifies the behaviour - of temporary schema variable at transaction commit. With this clause the + of a temporary schema variable at transaction commit. With this clause the      variable is dropped at commit time. The clause is only allowed -      for temporary variables. The <literal>ON TRANSACTIONAL END RESET</literal> +      for temporary variables. The <literal>ON TRANSACTION END RESET</literal> clause enforces the variable to be reset to its default value when - the transaction is either commited or rolled back. + the transaction is committed or rolled back. </para> </listitem> </varlistentry> @@ -145,7 +145,7 @@ <title>Notes</title> <para> - Use <command>DROP VARIABLE</command> command to remove a variable. + Use the <command>DROP VARIABLE</command> command to remove a variable. </para> </refsect1>
discard.sgml.20210108.diff (text/x-diff, 299B) download --- doc/src/sgml/ref/discard.sgml.orig 2021-01-08 18:02:25.837531779 +0100 +++ doc/src/sgml/ref/discard.sgml 2021-01-08 18:40:09.973630164 +0100 @@ -104,6 +104,7 @@ DISCARD PLANS; DISCARD TEMP; DISCARD SEQUENCES; +DISCARD VARIABLES; </programlisting></para> </listitem> </varlistentry>
drop_variable.sgml.20210108.diff (text/x-diff, 674B) download --- doc/src/sgml/ref/drop_variable.sgml.orig 2021-01-08 18:05:28.643147771 +0100 +++ doc/src/sgml/ref/drop_variable.sgml 2021-01-08 18:07:17.876113523 +0100 @@ -16,7 +16,7 @@ <refnamediv> <refname>DROP VARIABLE</refname> - <refpurpose>removes a schema variable</refpurpose> + <refpurpose>remove a schema variable</refpurpose> </refnamediv> <refsynopsisdiv> @@ -52,7 +52,7 @@ <term><replaceable class="parameter">name</replaceable></term> <listitem> <para> - The name (optionally schema-qualified) of a schema variable. + The name, optionally schema-qualified, of a schema variable. </para> </listitem> </varlistentry>
let.sgml.20210108.diff (text/x-diff, 1.1K) download --- doc/src/sgml/ref/let.sgml.orig 2021-01-08 18:09:52.757482768 +0100 +++ doc/src/sgml/ref/let.sgml 2021-01-08 18:13:23.071342113 +0100 @@ -44,16 +44,16 @@ <term><literal>schema_variable</literal></term> <listitem> <para> - The name of schema variable. + The name of the schema variable. </para> </listitem> </varlistentry> <varlistentry> - <term><literal>sql expression</literal></term> + <term><literal>sql_expression</literal></term> <listitem> <para> - An SQL expression, whose result is casted into the schema variable's type. + An SQL expression. The result is cast into the schema variable's type. </para> </listitem> </varlistentry> @@ -62,7 +62,7 @@ <term><literal>DEFAULT</literal></term> <listitem> <para> - Reset the schema variable to its default value, if it is defined. + Reset the schema variable to its default value, if that is defined.      If no explicit default value has been assigned, the schema variable is set to NULL. </para>
plpgsql.sgml.20210108.diff (text/x-diff, 845B) download --- doc/src/sgml/plpgsql.sgml.orig 2021-01-08 17:35:20.639186557 +0100 +++ doc/src/sgml/plpgsql.sgml 2021-01-08 17:37:36.108377973 +0100 @@ -5870,10 +5870,10 @@ <title><command>Global variables and constants</command></title> <para> - The <application>PL/pgSQL</application> language has no packages - and then it has not package variables and package constants. The + The <application>PL/pgSQL</application> language has no packages, + and therefore no package variables or package constants. The <productname>PostgreSQL</productname> has schema variables and - immutable schema variables. The schema variables can be created + immutable schema variables. Schema variables can be created by <command>CREATE VARIABLE</command> described in <xref linkend="sql-createvariable"/>. </para>

view thread (433+ messages)  latest in thread

Message-ID: <bdeb7611c6dbf22226c302bcc01d178b@xs4all.nl>
Permalink:  ../bdeb7611c6dbf22226c302bcc01d178b@xs4all.nl/
Also on:    postgresql.org/message-id/bdeb7611c6dbf22226c302bcc01d178b@xs4all.nl

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: er@xs4all.nl, pavel.stehule@gmail.com, michael@paquier.xyz, zyu@yugabyte.com, amit.kapila16@gmail.com, REMI.DUVAL@cheops.fr, pgsql-hackers@lists.postgresql.org
  Subject: Re: proposal: schema variables
  In-Reply-To: <bdeb7611c6dbf22226c302bcc01d178b@xs4all.nl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox