Re: Problems with casting

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Problems with casting
Дата
Msg-id 12879.1428442503@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Problems with casting  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Ответы Re: Problems with casting  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Список pgsql-general
Jim Nasby <Jim.Nasby@BlueTreble.com> writes:
> On 4/7/15 4:17 PM, Tom Lane wrote:
>> I suspect that that's only the tip of the iceberg.  Remember the mess
>> we had with implicit casts to text?  And those only existed for a dozen
>> or so types, not for everything.  Every function or operator you define
>> for "variant" is going to be a loaded gun just waiting to shoot your foot
>> off, if you make all those casts implicit.

> Yeah, that's why I avoided it. But that makes using it in a function a
> real pain. :( I think this is a bit of a different scenario though,
> because I don't see why you'd want to overload a function to accept both
> variant and some other type.

> Really what I want is for casting to variant to be a last-choice option,
> and even then only for function calls, not operators. I believe that
> would be safe, because then you'd have to explicitly be calling a
> function, or explicitly doing something::variant = variant.

Just out of curiosity, what's the point of this type at all, compared
to "anyelement" and friends?

            regards, tom lane


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

Предыдущее
От: Jim Nasby
Дата:
Сообщение: Re: [SQL] check data for datatype
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: Serializable transaction restart/re-execute