From 975bb2a57029a4ce06338104820451a85545257b Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Sun, 4 Feb 2024 14:13:53 -0500 Subject: [PATCH v1] 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. --- doc/src/sgml/func.sgml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 6788ba8ef4..afd821100a 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -25460,11 +25460,12 @@ SELECT collation for ('foo' COLLATE "de_DE"); regtype - Translates a textual type name to its OID. A similar result is + Parses a string of text, extracts a potential type name from it, and + translates that name into an OID. A similar result is obtained by casting the string to type regtype (see - ); however, this function will return - NULL rather than throwing an error if the name is - not found. + ). Failure to extract a valid potential + type name results in an error; however, if the extracted names is not + known to the system, this function will return NULL. -- 2.43.0