[tarantool-patches] Re: [PATCH 1/2] sql: derive collation for built-in functions

Konstantin Osipov kostja.osipov at gmail.com
Mon Mar 11 11:04:58 MSK 2019


* Vladislav Shpilevoy <v.shpilevoy at tarantool.org> [19/03/07 17:44]:
> It contradicts with your way of collation return. If PSQL states
> that collation is a part of string-like type, then it is
> possible to implement a function doing something like this:
> 
>     function my_func()
>         if (rand() % 2 == 0) then
>             return 'abc' collate 'unicode_ci';
>         return 'abc' collate 'unicode';
>     end;
> 
> (I do not know PSQL syntax - the code above is pseudo- ).

It would be impossible in SQL/PSM, since a function return value
is strictly typed, so there would be a type error or automatic
coercion to return type collation.

> As I see, now we have no runtime defined collations at all -
> all of them are known during compilation. Struct Mem, storing
> function return value, even has no collation member. I guess,
> we can not implement runtime collations now.

-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov




More information about the Tarantool-patches mailing list