1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Consider interpreting a function call as a trivial (binary-compatible)

type coercion after failing to find an exact match in pg_proc, but before
considering interpretations that involve a function call with one or
more argument type coercions.  This avoids surprises wherein what looks
like a type coercion is interpreted as coercing to some third type and
then to the destination type, as in Dave Blasby's bug report of 3-Oct-01.
See subsequent discussion in pghackers.
This commit is contained in:
Tom Lane
2001-10-04 22:06:46 +00:00
parent 1ca0874faa
commit 03b0a589d1
4 changed files with 119 additions and 84 deletions

View File

@ -458,6 +458,17 @@ this step.)
</para></step>
<step performance="required">
<para>
If no exact match appears in the catalog, see whether the function call appears
to be a trivial type coercion request. This happens if the function call
has just one argument and the function name is the same as the (internal)
name of some data type. Furthermore, the function argument must be either
an unknown-type literal or a type that is binary-compatible with the named
data type. When these conditions are met, the function argument is coerced
to the named data type without any explicit function call.
</para>
</step>
<step performance="required">
<para>
Look for the best match.
</para>
<substeps>
@ -519,17 +530,6 @@ then fail.
</step>
</substeps>
</step>
<step performance="required">
<para>
If no best match could be identified, see whether the function call appears
to be a trivial type coercion request. This happens if the function call
has just one argument and the function name is the same as the (internal)
name of some data type. Furthermore, the function argument must be either
an unknown-type literal or a type that is binary-compatible with the named
data type. When these conditions are met, the function argument is coerced
to the named data type.
</para>
</step>
</procedure>
<bridgehead renderas="sect2">Examples</bridgehead>