Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions

Поиск
Список
Период
Сортировка
От Vik Fearing
Тема Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions
Дата
Msg-id 0aa52082-152c-41d3-ac32-07818497afcd@postgresfriends.org
обсуждение исходный текст
Ответ на Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions  (jian he <jian.universality@gmail.com>)
Список pgsql-hackers


On 24/07/2025 03:22, jian he wrote:
+SELECT CAST('a' as int DEFAULT sum(1) ON CONVERSION ERROR); --error
+SELECT CAST('a' as int DEFAULT sum(1) over() ON CONVERSION ERROR); --error


This seems like an arbitrary restriction.  Can you explain why this is necessary?  Those same expressions are allowed as the <cast operand>.


+SELECT CAST('a' as int DEFAULT ret_setint() ON CONVERSION ERROR) --error
(ret_setint function is warped as (select 1 union all select 2))


This makes sense to me.


for array coerce, which you already mentioned, i think the following
is what we expected.
+SELECT CAST('{234,def,567}'::text[] AS integer[] DEFAULT '{-1011}' ON
CONVERSION ERROR);
+  int4
+---------
+ {-1011}
+(1 row)


Yes, that looks correct to me.


I didn't implement the [ FORMAT <cast template> ] part for now.


That is fine, since it's separate feature


please check the attached regress test and tests expected result.


Except for the weird restriction on the default value, this all looks good to me (with the usual caveat that I am not an expert in C).


Are you planning to also implement the <castable predicate>?

-- 

Vik Fearing

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