From 1d15921965a90027329933e0e32fc3f008ebe527 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Mon, 5 Feb 2024 09:00:29 -0500 Subject: [PATCH] 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 6788ba8ef4a54..0ff392ab05250 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 name is not + known to the system, this function will return NULL.