>
>> CONCAT('foo', NULL) => 'foo' really the behavior that everyone else
>> implements here? And why does CONCAT() take a variadic "ANY"
>> argument? Shouldn't that be variadic TEXT?
>
CONCAT with variadic text parameter will be limited with existing
default casts to text - for example, you can't to cast date to text,
int to text.
postgres=# create or replace function concat(variadic text[]) returns
text as $$select string_agg(x,'') from unnest($1) x$$ language sql;
CREATE FUNCTION
postgres=# select concat('a','b');concat
--------ab
(1 row)
Time: 20,812 ms
postgres=# select concat('a',10);
ERROR: function concat(unknown, integer) does not exist
LINE 1: select concat('a',10); ^
HINT: No function matches the given name and argument types. You
might need to add explicit type casts.
so with variadic "any"[] concat doesn't need explicit cats.
Regards
Pavel Stehule
p.s. inside function is every value transformed to text.
> merlin
>