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

Reply via email to