Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c772f10

Browse files
author
Nikita Glukhov
committed
Add documentation for JSON_TABLE PLAN DEFAULT clause
1 parent f034fcd commit c772f10

File tree

1 file changed

+101
-17
lines changed

1 file changed

+101
-17
lines changed

doc/src/sgml/func.sgml

Lines changed: 101 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18595,6 +18595,10 @@ FROM
1859518595
JSON_TABLE (
1859618596
<replaceable>context_item</replaceable>, <replaceable>path_expression</replaceable> <optional> PASSING { <replaceable>value</replaceable> AS <replaceable>varname</replaceable> } <optional>, ...</optional> </optional>
1859718597
COLUMNS ( <replaceable class="parameter">json_table_column</replaceable> <optional>, ...</optional> )
18598+
<optional>
18599+
PLAN DEFAULT ( { INNER | OUTER } <optional> , { CROSS | UNION } </optional>
18600+
| { CROSS | UNION } <optional> , { INNER | OUTER } </optional> )
18601+
</optional>
1859818602
)
1859918603
<phrase>
1860018604
where <replaceable class="parameter">json_table_column</replaceable> is:
@@ -18656,7 +18660,8 @@ where <replaceable class="parameter">json_table_column</replaceable> is:
1865618660
The rows produced by <function>JSON_TABLE</function> are laterally
1865718661
joined to the row that generated them, so you do not have to explicitly join
1865818662
the constructed view with the original table holding <acronym>JSON</acronym>
18659-
data.
18663+
data. Optionally, you can specify how to join the columns returned
18664+
by <literal>NESTED PATH</literal> using the <literal>PLAN DEFAULT</literal> clause.
1866018665
</para>
1866118666

1866218667
<para>
@@ -18669,22 +18674,6 @@ where <replaceable class="parameter">json_table_column</replaceable> is:
1866918674
the resulting rows are joined to the parent row.
1867018675
</para>
1867118676

18672-
<para>
18673-
Columns with parent/child relationship are joined using
18674-
<literal>LEFT OUTER JOIN</literal>, so that the parent row
18675-
is always included into the output even if it does not have any child rows
18676-
after joining the data returned by <literal>NESTED PATH</literal>,
18677-
with NULL values inserted into the child columns if the corresponding
18678-
values are missing.
18679-
</para>
18680-
18681-
<para>
18682-
Sibling columns are joined using
18683-
<literal>FULL OUTER JOIN ON FALSE</literal>, so that both parent and child
18684-
rows are included into the output, with NULL values inserted
18685-
into both child and parrent columns for all missing values.
18686-
</para>
18687-
1868818677
</sect5>
1868918678
<sect5>
1869018679
<title>Parameters</title>
@@ -18856,6 +18845,10 @@ where <replaceable class="parameter">json_table_column</replaceable> is:
1885618845
<function>JSON_TABLE</function> expressions in an SQL statement.
1885718846
</para>
1885818847

18848+
<para>
18849+
You can use the <literal>PLAN DEFAULT</literal> clause to define how
18850+
to join the columns returned by <replaceable>NESTED PATH</replaceable> clauses.
18851+
</para>
1885918852
</listitem>
1886018853
</varlistentry>
1886118854

@@ -18878,8 +18871,99 @@ where <replaceable class="parameter">json_table_column</replaceable> is:
1887818871
</listitem>
1887918872
</varlistentry>
1888018873

18874+
<varlistentry>
18875+
<term>
18876+
<literal>PLAN DEFAULT ( <replaceable>option</replaceable> [, ... ] )</literal>
18877+
</term>
18878+
<listitem>
18879+
<para>
18880+
Defines how to join the data returned by <replaceable>NESTED PATH</replaceable>
18881+
clauses to the constructed view. The <literal>INNER</literal> and
18882+
<literal>OUTER</literal> options define the joining plan for parent/child
18883+
columns, while <literal>UNION</literal> and <literal>CROSS</literal>
18884+
affect the sibling columns. You can override the default plans for all
18885+
columns at once.
18886+
</para>
18887+
18888+
<para>
18889+
To join columns with parent/child relationship, you can use:
18890+
</para>
18891+
<variablelist>
18892+
<varlistentry>
18893+
<term>
18894+
<literal>INNER</literal>
18895+
</term>
18896+
<listitem>
18897+
18898+
<para>
18899+
Use <literal>INNER JOIN</literal>, so that the parent row
18900+
is omitted from the output if it does not have any child rows
18901+
after joining the data returned by <literal>NESTED PATH</literal>.
18902+
</para>
18903+
</listitem>
18904+
</varlistentry>
18905+
18906+
<varlistentry>
18907+
<term>
18908+
<literal>OUTER</literal>
18909+
</term>
18910+
<listitem>
18911+
18912+
<para>
18913+
Use <literal>LEFT OUTER JOIN</literal>, so that the parent row
18914+
is always included into the output even if it does not have any child rows
18915+
after joining the data returned by <literal>NESTED PATH</literal>, with NULL values
18916+
inserted into the child columns if the corresponding
18917+
values are missing.
18918+
</para>
18919+
<para>
18920+
This is the default option for joining columns with parent/child relationship.
18921+
</para>
18922+
</listitem>
18923+
</varlistentry>
18924+
</variablelist>
18925+
18926+
<para>
18927+
To join sibling columns, you can use:
18928+
</para>
18929+
18930+
<variablelist>
18931+
<varlistentry>
18932+
<term>
18933+
<literal>UNION</literal>
18934+
</term>
18935+
<listitem>
18936+
18937+
<para>
18938+
Use <literal>FULL OUTER JOIN ON FALSE</literal>, so that both parent and child
18939+
rows are included into the output, with NULL values inserted
18940+
into both child and parrent columns for all missing values.
18941+
</para>
18942+
<para>
18943+
This is the default option for joining sibling columns.
18944+
</para>
18945+
</listitem>
18946+
</varlistentry>
18947+
18948+
<varlistentry>
18949+
<term>
18950+
<literal>CROSS</literal>
18951+
</term>
18952+
<listitem>
18953+
18954+
<para>
18955+
Use <literal>CROSS JOIN</literal>, so that the output includes
18956+
a row for every possible combination of rows from the left-hand
18957+
and the right-hand columns.
18958+
</para>
18959+
</listitem>
18960+
</varlistentry>
18961+
1888118962
</variablelist>
1888218963

18964+
</listitem>
18965+
</varlistentry>
18966+
</variablelist>
1888318967
</sect5>
1888418968

1888518969
<sect5>

0 commit comments

Comments
 (0)