Re: Patch: Add parse_type Function

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: Patch: Add parse_type Function
Дата
Msg-id CAFj8pRAtty0R96N6CAWgL3c7RueO9KVw=suU4STu5kc4G17ShA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Patch: Add parse_type Function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers


po 12. 2. 2024 v 19:20 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:
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.

+1

Pavel

                        regards, tom lane

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Patch: Add parse_type Function
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: [PATCH] Add native windows on arm64 support