Skip to content

Commit 1d15921

Browse files
committed
Update to_regtype docs regarding error condition
The statement that `to_regtype` returns `NULL` rather than raising an error turns out to be false when the parser cannot extract a type. This can happen for inputs such as `inteval second`, where the SQL grammar parser fails to parse the type name. In most cases it does return `NULL` and ideally it always would for such unknown types, but sadly the overhead of handling errors thrown by the grammar is too high at this point. So document the variation, instead.
1 parent b96115a commit 1d15921

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

doc/src/sgml/func.sgml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25460,11 +25460,12 @@ SELECT collation for ('foo' COLLATE "de_DE");
2546025460
<returnvalue>regtype</returnvalue>
2546125461
</para>
2546225462
<para>
25463-
Translates a textual type name to its OID. A similar result is
25463+
Parses a string of text, extracts a potential type name from it, and
25464+
translates that name into an OID. A similar result is
2546425465
obtained by casting the string to type <type>regtype</type> (see
25465-
<xref linkend="datatype-oid"/>); however, this function will return
25466-
<literal>NULL</literal> rather than throwing an error if the name is
25467-
not found.
25466+
<xref linkend="datatype-oid"/>). Failure to extract a valid potential
25467+
type name results in an error; however, if the extracted name is not
25468+
known to the system, this function will return <literal>NULL</literal>.
2546825469
</para></entry>
2546925470
</row>
2547025471
</tbody>

0 commit comments

Comments
 (0)