Skip to content

Commit

Permalink
Changements dans plpgsql pour la version 12.
Browse files Browse the repository at this point in the history
  • Loading branch information
dverite authored and gleu committed Jul 22, 2019
1 parent 94f66f6 commit 4bdd062
Showing 1 changed file with 43 additions and 37 deletions.
80 changes: 43 additions & 37 deletions postgresql/plpgsql.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3466,17 +3466,18 @@ END LOOP <optional> <replaceable>label</replaceable> </optional>;
<title>Gestion des transactions</title>

<indexterm zone="plpgsql-transaction-chain">
<primary>chained transactions</primary>
<secondary>in PL/pgSQL</secondary>
<primary>Transactions chaînées</primary>
<secondary>dans PL/pgSQL</secondary>
</indexterm>

<para id="plpgsql-transaction-chain">
A new transaction starts out with default transaction characteristics such
as transaction isolation level. In cases where transactions are committed
in a loop, it might be desirable to start new transactions automatically
with the same characteristics as the previous one. The commands
<command>COMMIT AND CHAIN</command> and <command>ROLLBACK AND
CHAIN</command> accomplish this.
Une nouvelle transaction démarre avec les caractéristiques de transaction
avec leurs valeurs par défaut, comme le niveau d'isolation.
Dans le cas où les transactions sont validées à l'intérieur d'une
boucle, on peut désirer qu'une transaction démarre automatiquement
avec les mêmes caractéristiques que la précédente. Les commandes
<command>COMMIT AND CHAIN</command> et <command>ROLLBACK AND
CHAIN</command> font cela.
</para>

<para>
Expand Down Expand Up @@ -5094,24 +5095,27 @@ then return '$$ || referrer_keys.referrer_type
</para>

<para>
Setting <varname>plpgsql.extra_warnings</varname>, or
<varname>plpgsql.extra_errors</varname>, as appropriate, to <literal>"all"</literal>
is encouraged in development and/or testing environments.
Positionner <varname>plpgsql.extra_warnings</varname> ou
<varname>plpgsql.extra_errors</varname>, selon les cas, à <literal>"all"</literal>
est encouragé dans les environnements de développement et de test.
</para>

<para>
These additional checks are enabled through the configuration variables
<varname>plpgsql.extra_warnings</varname> for warnings and
<varname>plpgsql.extra_errors</varname> for errors. Both can be set either to
a comma-separated list of checks, <literal>"none"</literal> or
<literal>"all"</literal>. The default is <literal>"none"</literal>. Currently
the list of available checks includes:
Ces vérifications supplémentaires sont activées via les variables de
configuration <varname>plpgsql.extra_warnings</varname> pour les messages
d'avertissement et <varname>plpgsql.extra_errors</varname> pour les erreurs.
Les deux peuvent être configurés soit avec une liste de vérifications séparées
par des virgules, soit pour aucune (<literal>"none"</literal>), soit pour
toutes (<literal>"all"</literal>). La valeur par défaut est
<literal>"none"</literal>. Actuellement la liste des vérifications possibles
comprend:

<variablelist>
<varlistentry>
<term><varname>shadowed_variables</varname></term>
<listitem>
<para>
Checks if a declaration shadows a previously defined variable.
Vérifie si une déclaration cache une variable définie précédemment.
</para>
</listitem>
</varlistentry>
Expand All @@ -5120,16 +5124,16 @@ then return '$$ || referrer_keys.referrer_type
<term><varname>strict_multi_assignment</varname></term>
<listitem>
<para>
Some <application>PL/PgSQL</application> commands allow assigning
values to more than one variable at a time, such as
<command>SELECT INTO</command>. Typically, the number of target
variables and the number of source variables should match, though
<application>PL/PgSQL</application> will use <literal>NULL</literal>
for missing values and extra variables are ignored. Enabling this
check will cause <application>PL/PgSQL</application> to throw a
<literal>WARNING</literal> or <literal>ERROR</literal> whenever the
number of target variables and the number of source variables are
different.
Certaines commandes <application>PL/PgSQL</application> permettent
d'affecter des valeurs à plus d'une variable à la fois, comme
<command>SELECT INTO</command>. Typiquement, le nombre de variables
cible et le nombre de variables source devraient correspondre,
même si <application>PL/PgSQL</application> utilise <literal>NULL</literal>
pour les valeurs manquantes et que les variables en excès sont ignorées.
Le fait d'autoriser ce test fera que <application>PL/PgSQL</application>
provoquera un avertissement (<literal>WARNING</literal>) ou une erreur
(<literal>ERROR</literal>) si jamais les nombres de variables cible et source
sont différents.
</para>
</listitem>
</varlistentry>
Expand All @@ -5138,19 +5142,21 @@ then return '$$ || referrer_keys.referrer_type
<term><varname>too_many_rows</varname></term>
<listitem>
<para>
Enabling this check will cause <application>PL/PgSQL</application> to
check if a given query returns more than one row when an
<literal>INTO</literal> clause is used. As an <literal>INTO</literal>
statement will only ever use one row, having a query return multiple
rows is generally either inefficient and/or nondeterministic and
therefore is likely an error.
L'activation de ce test fait que <application>PL/PgSQL</application>
vérifie si une requête utilisée avec un clause <literal>INTO</literal>
renvoie plus d'une ligne. Comme une instruction avec
<literal>INTO</literal> ne prendra en compte qu'une seule
ligne, le fait d'avoir une requête qui en retourne plusieurs
est généralement inefficace et/ou non-déterministe et par
conséquent est probablement une erreur.
</para>
</listitem>
</varlistentry>
</variablelist>

L'exemple suivant montre l'effet de <varname>plpgsql.extra_warnings</varname>
configuré à <varname>shadowed_variables</varname>&nbsp;:

<programlisting>
SET plpgsql.extra_warnings TO 'shadowed_variables';

Expand All @@ -5167,9 +5173,9 @@ LINE 3: f1 int;
CREATE FUNCTION
</programlisting>

The below example shows the effects of setting
<varname>plpgsql.extra_warnings</varname> to
<varname>strict_multi_assignment</varname>:
L'exemple suivant montre l'effet de <varname>plpgsql.extra_warnings</varname>
configuré à <varname>strict_multi_assignment</varname>:

<programlisting>
SET plpgsql.extra_warnings TO 'strict_multi_assignment';

Expand Down

0 comments on commit 4bdd062

Please sign in to comment.