Re: to_regtype() Raises Error

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Chapman Flack <chap(at)anastigmatix(dot)net>, Vik Fearing <vik(at)postgresfriends(dot)org>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: to_regtype() Raises Error
Date: 2024-02-05 00:11:48
Message-ID: es6buenafopxdti72kipw4leebgbmbpf3ixyjrv5ff34icy5z6@cqwiwul6aidi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2024-02-04 20:20 +0100, David E. Wheeler wrote:
> On Feb 2, 2024, at 15:33, David E. Wheeler <david(at)justatheory(dot)com> wrote:
>
> > Anyway, I’m happy to submit a documentation patch along the lines you suggested.
>
> How’s this?
>
> --- a/doc/src/sgml/func.sgml
> +++ b/doc/src/sgml/func.sgml
> @@ -25460,11 +25460,12 @@ SELECT collation for ('foo' COLLATE "de_DE");
> <returnvalue>regtype</returnvalue>
> </para>
> <para>
> - 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 <type>regtype</type> (see
> - <xref linkend="datatype-oid"/>); however, this function will return
> - <literal>NULL</literal> rather than throwing an error if the name is
> - not found.
> + <xref linkend="datatype-oid"/>). Failure to extract a valid potential
> + type name results in an error; however, if the extracted names is not

Here "extracted names" should be "extracted name" (singular).
Otherwise, the text looks good.

> + known to the system, this function will return <literal>NULL</literal>.
> </para></entry>
> </row>
> </tbody>
>
> Does similar wording need to apply to other `to_reg*` functions?

Just to_regtype() is fine IMO. The other to_reg* functions don't throw
errors on similar input, e.g.:

test=> select to_regproc('foo bar');
to_regproc
------------
<NULL>
(1 row)

--
Erik

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-02-05 00:53:52 Re: Grant read-only access to exactly one database amongst many
Previous Message Graham Leggett 2024-02-05 00:03:50 Grant read-only access to exactly one database amongst many