Re: Patch: Add parse_type Function
David E. Wheeler <david@justatheory.com>
From: "David E. Wheeler" <david@justatheory.com>
To: Jim Jones <jim.jones@uni-muenster.de>
Cc: Erik Wienhold <ewie@ewie.name>, jian he <jian.universality@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Pavel Stehule <pavel.stehule@gmail.com>, Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>, pgsql-hackers@lists.postgresql.org
Date: 2024-03-08T01:37:03Z
Lists: pgsql-hackers
Attachments
- v10-0001-Add-to_regtypemod-SQL-function.patch (application/octet-stream) patch v10-0001
Hello Hackers,
On Feb 25, 2024, at 13:00, David E. Wheeler <david@justatheory.com> wrote:
>> postgres=# SELECT to_regtypemod('timestamp(-4)');
>> ERROR: syntax error at or near "-"
>> LINE 1: SELECT to_regtypemod('timestamp(-4)');
>> ^
>> CONTEXT: invalid type name "timestamp(-4)"
>>
>> postgres=# SELECT to_regtypemod('text(-4)');
>> ERROR: type modifier is not allowed for type "text"
>
> Yeah, there was quite a bit of discussion of this issue back in September[1].
>
>> This behaviour is mentioned in the documentation, so I'd say it is ok.
>
> This is my attempt to make it clearer that it can return an error, but I don’t love the wording TBH.
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.
Best,
David
Commits
-
Add to_regtypemod function to extract typemod from a string type name.
- 1218ca9956ee 17.0 landed
-
Remove "#ifdef WIN32" guards from src/port/win32*.c
- 09eb633e1baa 17.0 cited