Re: missing something about json syntax

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: missing something about json syntax
Дата
Msg-id 3176185.1682023316@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: missing something about json syntax  (Marc Millas <marc.millas@mokadb.com>)
Ответы Re: missing something about json syntax  (Marc Millas <marc.millas@mokadb.com>)
Список pgsql-general
Marc Millas <marc.millas@mokadb.com> writes:
> but it doesnt explain how postgres is able to put a scalar in a json or
> jsonb column without pb:
> I don't understand how this ('"{\"t\"}"') can be considered  a valid enough
> json to be inserted in a json column
> and at the same time invalid for all other json uses.

That's a bare string (it's not an object).  That's valid JSON per
RFC 7159:

   JSON can represent four primitive types (strings, numbers, booleans,
   and null) and two structured types (objects and arrays).
   ...
   A JSON text is a serialized value.  Note that certain previous
   specifications of JSON constrained a JSON text to be an object or an
   array.

However, there certainly are some operations that require the top-level
value to be an object or array.

            regards, tom lane



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

Предыдущее
От: Marc Millas
Дата:
Сообщение: Re: missing something about json syntax
Следующее
От: Isaiah Langford
Дата:
Сообщение: Why does the planner reduce the planned rows when filtering single values in an array