Skip to content

Commit

Permalink
json file
Browse files Browse the repository at this point in the history
  • Loading branch information
superette authored and gleu committed Sep 28, 2019
1 parent e0d20d9 commit 2e4035b
Showing 1 changed file with 106 additions and 99 deletions.
205 changes: 106 additions & 99 deletions postgresql/json.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
</para>

<para>
<productname>PostgreSQL</productname> offers two types for storing JSON
data: <type>json</type> and <type>jsonb</type>. To implement effective query
mechanisms for these data types, <productname>PostgreSQL</productname>
also provides the <type>jsonpath</type> data type described in
<xref linkend="datatype-jsonpath"/>.
<productname>PostgreSQL</productname> propose deux types pour stocker des
données JSON : <type>json</type> and <type>jsonb</type>.
Pour implémenter des mécanismes de requêtage efficaces pour ces types de
données <productname>PostgreSQL</productname> propose aussi le type
<type>jsonpath</type> décrit dans <xref linkend="datatype-jsonpath"/>.
</para>

<para>
Expand Down Expand Up @@ -238,8 +238,8 @@ SELECT '{"reading": 1.230e-5}'::json, '{"reading": 1.230e-5}'::jsonb;
</para>

<para>
For the list of built-in functions and operators available for
constructing and processing JSON values, see <xref linkend="functions-json"/>.
Pour la liste de fonctions et opérateurs intégrés disponibles pour construire
et traiter des valeurs JSON, voyez <xref linkend="functions-json"/>.
</para>
</sect2>

Expand All @@ -253,7 +253,7 @@ SELECT '{"reading": 1.230e-5}'::json, '{"reading": 1.230e-5}'::jsonb;
au sein de la même application. Toutefois, même pour les applications où on
désire le maximum de flexibilité, il est toujours recommandé que les
documents JSON aient une structure quelque peu fixée. La structure est
typiquement non vérifiée (bien que vérifier des règles métier de manière
typiquement non vérifiée (bien que vérifier des règles métier de manière
déclarative soit possible), mais le fait d'avoir une
structure prévisible rend plus facile l'écriture de requêtes qui résument
utilement un ensemble de <quote>documents</quote> (datums) dans une table.
Expand Down Expand Up @@ -419,15 +419,15 @@ SELECT doc-&gt;'site_name' FROM websites
</indexterm>

<para>
Les index GIN peuvent être utilisés pour chercher efficacement des clés ou
Les index GIN peuvent être utilisés pour chercher efficacement des clés ou des
paires clé/valeur se trouvant parmi un grand nombre de documents (datums)
<type>jsonb</type>. Deux <quote>classes d'opérateurs</quote> GIN sont
fournies, offrant différents compromis entre performances et flexibilité.
</para>
<para>
La classe d'opérateur GIN par défaut pour <type>jsonb</type> supporte les
requêtes avec des opérateurs de haut niveau clé-existe <literal>?</literal>, <literal>?&amp;</literal>
et des opérateurs <literal>?|</literal> et l'opérateur chemin/valeur-existe
et des opérateurs <literal>?|</literal> et l'opérateur path/valeur-existe
<literal>@&gt;</literal>.
(Pour des détails sur la sémantique que ces opérateurs implémentent,
voir <xref linkend="functions-jsonb-op-table"/>.)
Expand Down Expand Up @@ -498,20 +498,21 @@ CREATE INDEX idxgintags ON api USING GIN ((jdoc -&gt; 'tags'));
trouvées dans <xref linkend="indexes-expressional"/>.)
</para>
<para>
Also, GIN index supports <literal>@@</literal> and <literal>@?</literal>
operators, which perform <literal>jsonpath</literal> matching.
Les index GIN supportent aussi les opérateurs <literal>@@</literal>
et <literal>@?</literal>qui réalisent la correspondance avec le
<literal>jsonpath</literal>.
<programlisting>
SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @@ '$.tags[*] == "qui"';
</programlisting>
<programlisting>
SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @@ '$.tags[*] ? (@ == "qui")';
</programlisting>
GIN index extracts statements of following form out of
<literal>jsonpath</literal>: <literal>accessors_chain = const</literal>.
Accessors chain may consist of <literal>.key</literal>,
<literal>[*]</literal> and <literal>[index]</literal> accessors.
<literal>jsonb_ops</literal> additionally supports <literal>.*</literal>
and <literal>.**</literal> statements.
L'index GIN extrait les informations de la forme suivante du
<literal>jsonpath</literal>: <literal>chaîne d'acccès = const</literal>.
La chaîne d'accès peut être <literal>.key</literal>,
<literal>[*]</literal> et <literal>[index]</literal>.
<literal>jsonb_ops</literal> supporte aussi les syntaxes <literal>.*</literal>
et <literal>.**</literal>.
</para>
<para>
Une autre approche pour le requêtage et l'exploitation de l'inclusion, par exemple&nbsp;:
Expand Down Expand Up @@ -647,98 +648,102 @@ SELECT jdoc-&gt;'guid', jdoc-&gt;'name' FROM api WHERE jdoc @&gt; '{"tags": ["qu
</sect2>

<sect2 id="datatype-jsonpath">
<title>jsonpath Type</title>
<title>Type jsonpath</title>

<indexterm zone="datatype-jsonpath">
<primary>jsonpath</primary>
</indexterm>

<para>
The <type>jsonpath</type> type implements support for the SQL/JSON path language
in <productname>PostgreSQL</productname> to effectively query JSON data.
It provides a binary representation of the parsed SQL/JSON path
expression that specifies the items to be retrieved by the path
engine from the JSON data for further processing with the
SQL/JSON query functions.
Le type <type>jsonpath</type> implémente le support du langage
SQL/JSONpath dans <productname>PostgreSQL</productname> de façon à requêter
correctement dans les données JSON.
Cela fournit une représentation binaire de l'expression SQL/JSONpath analysée
qui spécifie les valeurs qui doivent être récupérées par le moteur de path
depuis les données JSON pour être traités par la suite avec les fonctions
de requêtage SQL/JSON.
</para>

<para>
The SQL/JSON path language is fully integrated into the SQL engine:
the semantics of its predicates and operators generally follow SQL.
At the same time, to provide a most natural way of working with JSON data,
SQL/JSON path syntax uses some of the JavaScript conventions:
Le langage SQL/JSONpath est complètement intégré dans le moteur SQL:
La sémantique des prédicats et opérateurs suit généralement SQL.
Dans le même temps, il propose la manière la plus naturelle de travailler
avec les données JSON, en effet la syntaxe SQL/JSONpath utilise certaine des
conventions JavaScript:
</para>

<itemizedlist>
<listitem>
<para>
Dot <literal>.</literal> is used for member access.
Le point <literal>.</literal> est utilisé pour accéder à une valeur.
</para>
</listitem>
<listitem>
<para>
Square brackets <literal>[]</literal> are used for array access.
Les crochets <literal>[]</literal> sont utilisés pour accéder à un tableau.
</para>
</listitem>
<listitem>
<para>
SQL/JSON arrays are 0-relative, unlike regular SQL arrays that start from 1.
Les tableaux SQL/JSON commencent à partir de 0, contrairement aux tableaux SQL
classiques qui commmencent à 1.
</para>
</listitem>
</itemizedlist>

<para>
An SQL/JSON path expression is an SQL character string literal,
so it must be enclosed in single quotes when passed to an SQL/JSON
query function. Following the JavaScript
conventions, character string literals within the path expression
must be enclosed in double quotes. Any single quotes within this
character string literal must be escaped with a single quote
by the SQL convention.
Lorsqu'elle est passée dans une fonction de requête SQL/JSON, une expression
SQL/JSONpath étant une chaîne de caractères SQL, elle doit être
entourée de guillemets simple ('').
En suivant la convention JavaScript, les chaînes de caractères doivent être entourées
de guillemets double ("").
Selon la convention SQL, dans ces chaînes de caractère, tous les guillemets simple doivent
être échappés avec un guillemet simple.
</para>

<para>
A path expression consists of a sequence of path elements,
which can be the following:
Une expression path consiste en une séquence d'éléments path, qui peuvent
être les suivants:
<itemizedlist>
<listitem>
<para>
Path literals of JSON primitive types:
Unicode text, numeric, true, false, or null.
Path litéral de type primitifs JSON:
Unicode text, numeric, true, false, ou null.
</para>
</listitem>
<listitem>
<para>
Path variables listed in <xref linkend="type-jsonpath-variables"/>.
Variables Path listées dans <xref linkend="type-jsonpath-variables"/>.
</para>
</listitem>
<listitem>
<para>
Accessor operators listed in <xref linkend="type-jsonpath-accessors"/>.
Opérateurs d'accès listés dans <xref linkend="type-jsonpath-accessors"/>.
</para>
</listitem>
<listitem>
<para>
<type>jsonpath</type> operators and methods listed
in <xref linkend="functions-sqljson-path-operators"/>
Opérateurs et méthodes <type>jsonpath</type> listés dans
<xref linkend="functions-sqljson-path-operators"/>
</para>
</listitem>
<listitem>
<para>
Parentheses, which can be used to provide filter expressions
or define the order of path evaluation.
Les parenthèses, qui peuvent être utilisées pour filtrer des expressions
ou définir l'ordre d'évaluation des Path.
</para>
</listitem>
</itemizedlist>
</para>

<para>
For details on using <type>jsonpath</type> expressions with SQL/JSON
query functions, see <xref linkend="functions-sqljson-path"/>.

Pour plus de détails concernant l'utilisation des expressions <type>jsonpath</type>
avec des fonctions de requête SQL/JSON, voir <xref linkend="functions-sqljson-path"/>.
</para>

<table id="type-jsonpath-variables">
<title><type>jsonpath</type> Variables</title>
<title>Variables <type>jsonpath</type></title>
<tgroup cols="2">
<thead>
<row>
Expand All @@ -749,56 +754,56 @@ SELECT jdoc-&gt;'guid', jdoc-&gt;'name' FROM api WHERE jdoc @&gt; '{"tags": ["qu
<tbody>
<row>
<entry><literal>$</literal></entry>
<entry>A variable representing the JSON text to be queried
(the <firstterm>context item</firstterm>).
<entry>Une variable qui représente le JSON text à requêter
(L' <firstterm>item de contexte</firstterm>).
</entry>
</row>
<row>
<entry><literal>$varname</literal></entry>
<entry>
A named variable. Its value can be set by the parameter
<parameter>vars</parameter> of several JSON processing functions.
See <xref linkend="functions-json-processing-table"/> and
its notes for details.
Une variable nommée. Le paramètre <parameter>vars</parameter> présent dans
de nombreuses fonctions de traitement JSON, permet de définir sa valeur.
Voir <xref linkend="functions-json-processing-table"/> ainsi que les notes
pour plus de détails.
<!-- TODO: describe PASSING clause once implemented !-->
</entry>
</row>
<row>
<entry><literal>@</literal></entry>
<entry>A variable representing the result of path evaluation
in filter expressions.
<entry>Une variable qui représente le résultat de l'évaluation du path dans
un filtre.
</entry>
</row>
</tbody>
</tgroup>
</table>

<table id="type-jsonpath-accessors">
<title><type>jsonpath</type> Accessors</title>
<title>Accesseurs <type>jsonpath</type></title>
<tgroup cols="2">
<thead>
<row>
<entry>Accessor Operator</entry>
<entry>Opérateurs d'accès</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>
<para>
<literal>.<replaceable>key</replaceable></literal>
<literal>.<replaceable>clé</replaceable></literal>
</para>
<para>
<literal>."$<replaceable>varname</replaceable>"</literal>
<literal>."$<replaceable>nom de variable</replaceable>"</literal>
</para>
</entry>
<entry>
<para>
Member accessor that returns an object member with
the specified key. If the key name is a named variable
starting with <literal>$</literal> or does not meet the
JavaScript rules of an identifier, it must be enclosed in
double quotes as a character string literal.
La valeur accédée renvoie un objet avec la clé spécifiée.
Si le nom de la clé est une variable nommée qui commence avec
<literal>$</literal> ou qui n'est pas compatible avec les règles
JavaScript d'un identifiant, ce nom doit être entouré avec des guillemets
double comme une chaîne de caractères.
</para>
</entry>
</row>
Expand All @@ -810,8 +815,8 @@ SELECT jdoc-&gt;'guid', jdoc-&gt;'name' FROM api WHERE jdoc @&gt; '{"tags": ["qu
</entry>
<entry>
<para>
Wildcard member accessor that returns the values of all
members located at the top level of the current object.
L'accès "joker" renvoie les valeurs de tous les membres
se trouvant au plus haut niveau de l'objet courant.
</para>
</entry>
</row>
Expand All @@ -823,11 +828,11 @@ SELECT jdoc-&gt;'guid', jdoc-&gt;'name' FROM api WHERE jdoc @&gt; '{"tags": ["qu
</entry>
<entry>
<para>
Recursive wildcard member accessor that processes all levels
of the JSON hierarchy of the current object and returns all
the member values, regardless of their nesting level. This
is a <productname>PostgreSQL</productname> extension of
the SQL/JSON standard.
L'accès "joker" récursif traite tous les niveaux de
l'arborescence JSON de l'objet courant, et retourne toutes
les valeurs, peu importe leur niveau d'imbrication.
Ceci est une extension <productname>PostgreSQL</productname>
du standard SQL/JSON
</para>
</entry>
</row>
Expand All @@ -837,18 +842,20 @@ SELECT jdoc-&gt;'guid', jdoc-&gt;'name' FROM api WHERE jdoc @&gt; '{"tags": ["qu
<literal>.**{<replaceable>level</replaceable>}</literal>
</para>
<para>
<literal>.**{<replaceable>start_level</replaceable> to
<literal>.**{<replaceable>start_level</replaceable> au
<replaceable>end_level</replaceable>}</literal>
</para>
</entry>
<entry>
<para>
Same as <literal>.**</literal>, but with a filter over nesting
levels of JSON hierarchy. Nesting levels are specified as integers.
Zero level corresponds to the current object. To access the lowest
nesting level, you can use the <literal>last</literal> keyword.
This is a <productname>PostgreSQL</productname> extension of
the SQL/JSON standard.
Identique à <literal>.**</literal>, mais avec un filtre au dessus
des niveaux d'imbrications de l'arborescence JSON.
Les niveaux d'imbrications sont spécifiés en entiers.
Le niveau zéro correspond à l'objet courant.
Pour accèder au dernier niveau d'imbrication, vous pouvez utiliser
le mot clé <literal>last</literal>.
Ceci est une extension <productname>PostgreSQL</productname>
du standard SQL/JSON.
</para>
</entry>
</row>
Expand All @@ -860,22 +867,22 @@ SELECT jdoc-&gt;'guid', jdoc-&gt;'name' FROM api WHERE jdoc @&gt; '{"tags": ["qu
</entry>
<entry>
<para>
Array element accessor.
<literal><replaceable>subscript</replaceable></literal> can be
given in two forms: <literal><replaceable>index</replaceable></literal>
or <literal><replaceable>start_index</replaceable> to <replaceable>end_index</replaceable></literal>.
The first form returns a single array element by its index. The second
form returns an array slice by the range of indexes, including the
elements that correspond to the provided
<replaceable>start_index</replaceable> and <replaceable>end_index</replaceable>.
</para>
Accès au valeurs d'un tableau.
<literal><replaceable>subscript</replaceable></literal> peut être
donné sous deux formes: <literal><replaceable>index</replaceable></literal>
ou <literal><replaceable>start_index</replaceable> à
<replaceable>end_index</replaceable></literal>.
La première forme renvoie une simple valeur du tableau par son index. La
seconde forme renvoie un morceau de tableau provenant d'un intervalle
d'index, en incluant les valeurs qui correspondent à celles fournies dans
<replaceable>start_index</replaceable> et <replaceable>end_index</replaceable>.
<para>
The specified <replaceable>index</replaceable> can be an integer, as
well as an expression returning a single numeric value, which is
automatically cast to integer. Zero index corresponds to the first
array element. You can also use the <literal>last</literal> keyword
to denote the last array element, which is useful for handling arrays
of unknown length.
L'<replaceable>index</replaceable> spécifié peut être un entier, aussi bien
qu'une expression renvoyant une simple valeur numérique, qui sera automatiquement
transtypé vers un entier. L'index zéro correspond à la première valeur d'un
tableau. Vous pouvez aussi utiliser le mot clé <literal>last</literal> pour
indiquer le dernier élément, ce qui est utile pour manipuler des tableaux
de longueur inconnue.
</para>
</entry>
</row>
Expand All @@ -887,7 +894,7 @@ SELECT jdoc-&gt;'guid', jdoc-&gt;'name' FROM api WHERE jdoc @&gt; '{"tags": ["qu
</entry>
<entry>
<para>
Wildcard array element accessor that returns all array elements.
L'accès "joker" tableau qui renvoie toutes les valeurs du tableau.
</para>
</entry>
</row>
Expand Down

0 comments on commit 2e4035b

Please sign in to comment.