Re: Patch: Add parse_type Function

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: "David E. Wheeler" <david@justatheory.com>
Cc: Erik Wienhold <ewie@ewie.name>, Pavel Stehule <pavel.stehule@gmail.com>, jian he <jian.universality@gmail.com>, Jim Jones <jim.jones@uni-muenster.de>, Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>, pgsql-hackers@lists.postgresql.org
Date: 2024-02-19T20:47:22Z
Lists: pgsql-hackers
"David E. Wheeler" <david@justatheory.com> writes:
> The only way I can think of to avoid that is to:

> 1. Add a to_regtypmod() for those who just want the typemod.

Seems like there's a good case for doing that.

> 2. Add a format_type_string() function that returns a string, the equivalent of this function but in C:

> CREATE FUNCTION format_type_string(text) RETURNS TEXT AS $$
>    SELECT format_type(to_regtype($1), to_regtypmod($1))
> $$;

I'm less thrilled about that, mainly because I can't think of
a good name for it ("format_type_string" is certainly not that).
Is the use-case for this functionality really strong enough that
we need to provide it as a single function rather than something
assembled out of spare parts?

			regards, tom lane



Commits

  1. Add to_regtypemod function to extract typemod from a string type name.

  2. Remove "#ifdef WIN32" guards from src/port/win32*.c