@@ -18595,6 +18595,10 @@ FROM
18595
18595
JSON_TABLE (
18596
18596
<replaceable>context_item</replaceable>, <replaceable>path_expression</replaceable> <optional> PASSING { <replaceable>value</replaceable> AS <replaceable>varname</replaceable> } <optional>, ...</optional> </optional>
18597
18597
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>
18598
18602
)
18599
18603
<phrase>
18600
18604
where <replaceable class="parameter">json_table_column</replaceable> is:
@@ -18656,7 +18660,8 @@ where <replaceable class="parameter">json_table_column</replaceable> is:
18656
18660
The rows produced by <function>JSON_TABLE</function> are laterally
18657
18661
joined to the row that generated them, so you do not have to explicitly join
18658
18662
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.
18660
18665
</para>
18661
18666
18662
18667
<para>
@@ -18669,22 +18674,6 @@ where <replaceable class="parameter">json_table_column</replaceable> is:
18669
18674
the resulting rows are joined to the parent row.
18670
18675
</para>
18671
18676
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
-
18688
18677
</sect5>
18689
18678
<sect5>
18690
18679
<title>Parameters</title>
@@ -18856,6 +18845,10 @@ where <replaceable class="parameter">json_table_column</replaceable> is:
18856
18845
<function>JSON_TABLE</function> expressions in an SQL statement.
18857
18846
</para>
18858
18847
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>
18859
18852
</listitem>
18860
18853
</varlistentry>
18861
18854
@@ -18878,8 +18871,99 @@ where <replaceable class="parameter">json_table_column</replaceable> is:
18878
18871
</listitem>
18879
18872
</varlistentry>
18880
18873
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
+
18881
18962
</variablelist>
18882
18963
18964
+ </listitem>
18965
+ </varlistentry>
18966
+ </variablelist>
18883
18967
</sect5>
18884
18968
18885
18969
<sect5>
0 commit comments