Re: Better performance no-throw conversion?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Better performance no-throw conversion?
Дата
Msg-id 3435889.1631122378@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Better performance no-throw conversion?  ("ldh@laurent-hasson.com" <ldh@laurent-hasson.com>)
Ответы Re: Better performance no-throw conversion?  (Michael Lewis <mlewis@entrata.com>)
Список pgsql-performance
"ldh@laurent-hasson.com" <ldh@laurent-hasson.com> writes:
> Some databases such as SQLServer (try_cast) or BigQuery (safe.cast) offer not-throw conversion.
> ...
> I couldn't find a reference to such capabilities in Postgres and wondered if I missed it, and if not, is there any
planto add such a feature? 

There is not anybody working on that AFAIK.  It seems like it'd have
to be done on a case-by-case basis, which makes it awfully tedious.
The only way I can see to do it generically is to put a subtransaction
wrapper around the cast-function call, which is a lousy idea for a
couple of reasons:

1. It pretty much negates any performance benefit.

2. It'd be very hard to tell which errors are safe to ignore
and which are not (e.g., internal errors shouldn't be trapped
this way).

Of course, point 2 also applies to user-level implementations
(IOW, your code feels pretty unsafe to me).  So anything we might
do here would be an improvement.  But it's still problematic.

            regards, tom lane



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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: Better performance no-throw conversion?
Следующее
От: Michael Lewis
Дата:
Сообщение: Re: Better performance no-throw conversion?