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
--- 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>
--- 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>
--- 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>
--- 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>
--- 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>