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

From Tom Lane
Subject Re: Patch: Add parse_type Function
Date
Msg-id 2248752.1707762004@sss.pgh.pa.us
Whole thread Raw
In response to Re: Patch: Add parse_type Function  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Patch: Add parse_type Function
Re: Patch: Add parse_type Function
List pgsql-hackers
I wrote:
> It strikes me that this is basically to_regtype() with the additional
> option to return the typmod.  That leads to some questions:

BTW, another way that this problem could be approached is to use
to_regtype() as-is, with a separate function to obtain the typmod:

select format_type(to_regtype('timestamp(4)'), to_regtypmod('timestamp(4)'));

This is intellectually ugly, since it implies parsing the same
typename string twice.  But on the other hand it avoids the notational
pain and runtime overhead involved in using a record-returning
function.  So I think it might be roughly a wash for performance.
Question to think about is which way is easier to use.  I don't
have an opinion particularly; just throwing the idea out there.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Matthias van de Meent
Date:
Subject: Re: Reducing output size of nodeToString
Next
From: Pavel Stehule
Date:
Subject: Re: Patch: Add parse_type Function