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-02-25T18:00:24Z
Lists: pgsql-hackers
On Feb 24, 2024, at 19:11, Jim Jones <jim.jones@uni-muenster.de> wrote:
>> What’s the protocol for marking a patch ready for committer?
>
> I guess after the review of the last assigned reviewer
Oh, I didn’t realize someone was assigned. :-)
> The fact that a completely invalid type returns NULL ..
>
> SELECT to_regtypemod('foo');
> to_regtypemod
> ---------------
>
> (1 row)
>
>
> .. but a "partially" valid one returns an error might be confusing
>
> 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 would personally prefer either NULL or an error in both cases, but I
> can totally live with the current design.
SAME.
Best,
David
[1] https://www.postgresql.org/message-id/flat/09F9CAD6-5096-43CC-B6A7-685703E4714D@justatheory.com
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