to_json documentation wrt. casts is misleading

Поиск
Список
Период
Сортировка
От Jan Hamal Dvořák
Тема to_json documentation wrt. casts is misleading
Дата
Msg-id 61bbc030-8eda-5290-0c8c-ca5a1c853888@techlib.cz
обсуждение исходный текст
Список pgsql-bugs
Hi,

documentation for functions `to_json` and `to_jsonb` states:

 > Arrays and composites are converted (recursively) to arrays and 
objects; otherwise, if there is a cast from the type to json, the cast 
function will be used to perform the conversion; otherwise, a scalar 
value is produced. For any scalar type other than a number, a Boolean, 
or a null value, the text representation will be used, in such a fashion 
that it is a valid json or jsonb value.

This might get interpreted in the sense that "if there is a cast from 
the type to json, the cast function will be used to perform the 
conversion" regardless of whether the value is an "array or composite".

     https://stackoverflow.com/questions/35688503/

Would it be possible to adjust the wording in a way that makes this more 
clear?

Or, alternatively, would it be possible to make use of implicit casts in 
all cases so that the distinction needs not to be made?

Best regards
Jan Hamal Dvořák



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

Предыдущее
От: Gopichand Gatte
Дата:
Сообщение: Regarding PostgreSQL
Следующее
От: Michael Meskes
Дата:
Сообщение: Re: BUG #15176: ecpg generation error