Re: patch (for 9.1) string functions

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: patch (for 9.1) string functions
Дата
Msg-id AANLkTimKiNH0E8BRvZthgpuvxdY4FR_m6w81-px867St@mail.gmail.com
обсуждение исходный текст
Ответ на Re: patch (for 9.1) string functions  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-hackers
>
>> 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
>


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

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: patch (for 9.1) string functions
Следующее
От: Robert Haas
Дата:
Сообщение: Re: patch (for 9.1) string functions