Re: Patch: Add parse_type Function - Mailing list pgsql-hackers

From Erik Wienhold
Subject Re: Patch: Add parse_type Function
Date
Msg-id tdiav2jrai6vds7xtijx3db7k6voehk73rptsnfc5pcsn2n3ht@ocr5sleep5j3
Whole thread Raw
In response to Re: Patch: Add parse_type Function  ("David E. Wheeler" <david@justatheory.com>)
Responses Re: Patch: Add parse_type Function
List pgsql-hackers
Hi David,

On 2024-03-08 02:37 +0100, David E. Wheeler wrote:
> I’ve rebased the patch and, in an attempt to clarify this behavior,
> added a couple of examples to the docs for to_regtype. Updated patch
> attached.

On your latest addition:

> +        <xref linkend="datatype-oid"/>). Failure to extract a valid potential
> +        type name results in an error. For example:
> +<programlisting>
> +SELECT to_regtype('party');
> + to_regtype
> +------------
> +
> +</programlisting>
> +        However, if the extracted name is not known to the system, this function
> +        will return <literal>NULL</literal>. For example:
> +<programlisting>
> +SELECT to_regtype('interval nonesuch');
> +ERROR:  syntax error at or near "nonesuch"
> +LINE 1: select to_regtype('interval nonesuch');
> +                 ^
> +CONTEXT:  invalid type name "interval nonesuch"
> +</programlisting>

I think you need to swap the examples.  The text mentions the error case
first and the NULL case second.

-- 
Erik



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: ALTER TABLE SET ACCESS METHOD on partitioned tables
Next
From: shveta malik
Date:
Subject: Re: Synchronizing slots from primary to standby