From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Erik Rijkers <er(at)xs4all(dot)nl> |
Subject: | Re: patch (for 9.1) string functions |
Date: | 2010-07-26 13:26:05 |
Message-ID: | AANLkTimKiNH0E8BRvZthgpuvxdY4FR_m6w81-px867St@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
>
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2010-07-26 13:26:59 | Re: patch (for 9.1) string functions |
Previous Message | Merlin Moncure | 2010-07-26 13:10:06 | Re: patch (for 9.1) string functions |