Re: pgsql: Add more SQL/JSON constructor functions

Поиск
Список
Период
Сортировка
От jian he
Тема Re: pgsql: Add more SQL/JSON constructor functions
Дата
Msg-id CACJufxEo4sUjKCYtda0_qt9tazqqKPmF1cqhW9KBOUeJFqQd2g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pgsql: Add more SQL/JSON constructor functions  (Amit Langote <amitlangote09@gmail.com>)
Ответы Re: pgsql: Add more SQL/JSON constructor functions
Список pgsql-hackers
we still have problem in transformJsonBehavior

currently transformJsonBehavior:
SELECT JSON_VALUE(jsonb '1234', '$' RETURNING bit(3)  DEFAULT 010111 ON ERROR);
ERROR:  cannot cast behavior expression of type text to bit
LINE 1: ...VALUE(jsonb '1234', '$' RETURNING bit(3)  DEFAULT 010111 ON ...

here, 010111 will default to int4, so "cannot cast behavior expression
of type text to bit"
is wrong?
also int4/int8 can be explicitly cast to bit(3), in this case, it
should return 111.


Also, do we want to deal with bit data type's typmod like we did for
string type in transformJsonBehavior?
like:
SELECT JSON_VALUE(jsonb '"111"', '$'  RETURNING bit(3) default '1111' on error);
should return error:
ERROR:  bit string length 2 does not match type bit(3)
or success

The attached patch makes it return an error, similar to what we did
for the fixed length string type.

Вложения

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Pluggable cumulative statistics
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: Built-in CTYPE provider