Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit22e75a3

Browse files
committed
Doc: fix description of UNION/CASE/etc type unification.
The description of what select_common_type() does was not terriblyaccurate. Improve it.David Johnston and Tom LaneDiscussion:https://postgr.es/m/1019930.1597613200@sss.pgh.pa.us
1 parenta28d731 commit22e75a3

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

‎doc/src/sgml/typeconv.sgml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ domain's base type for all subsequent steps.
10691069
functions, this behavior allows a domain type to be preserved through
10701070
a <literal>UNION</literal> or similar construct, so long as the user is
10711071
careful to ensure that all inputs are implicitly or explicitly of that
1072-
exact type. Otherwise the domain's base type will bepreferred.
1072+
exact type. Otherwise the domain's base type will beused.
10731073
</para>
10741074
</footnote>
10751075
</para>
@@ -1092,24 +1092,29 @@ If the non-unknown inputs are not all of the same type category, fail.
10921092

10931093
<step performance="required">
10941094
<para>
1095-
Choose the first non-unknown input type which is a preferred type in
1096-
that category, if there is one.
1097-
</para>
1098-
</step>
1099-
1100-
<step performance="required">
1101-
<para>
1102-
Otherwise, choose the last non-unknown input type that allows all the
1103-
preceding non-unknown inputs to be implicitly converted to it. (There
1104-
always is such a type, since at least the first type in the list must
1105-
satisfy this condition.)
1095+
Select the first non-unknown input type as the candidate type,
1096+
then consider each other non-unknown input type, left to right.
1097+
<footnote>
1098+
<para>
1099+
For historical reasons, <literal>CASE</literal> treats
1100+
its <literal>ELSE</literal> clause (if any) as the <quote>first</quote>
1101+
input, with the <literal>THEN</literal> clauses(s) considered after
1102+
that. In all other cases, <quote>left to right</quote> means the order
1103+
in which the expressions appear in the query text.
1104+
</para>
1105+
</footnote>
1106+
If the candidate type can be implicitly converted to the other type,
1107+
but not vice-versa, select the other type as the new candidate type.
1108+
Then continue considering the remaining inputs. If, at any stage of this
1109+
process, a preferred type is selected, stop considering additional
1110+
inputs.
11061111
</para>
11071112
</step>
11081113

11091114
<step performance="required">
11101115
<para>
1111-
Convert all inputs to theselectedtype. Fail if there is nota
1112-
conversion from a given input to theselected type.
1116+
Convert all inputs to thefinal candidatetype. Fail if there is notan
1117+
implicitconversion from a given inputtypeto thecandidate type.
11131118
</para>
11141119
</step>
11151120
</procedure>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp