Re: JsonbValue to Jsonb conversion

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: JsonbValue to Jsonb conversion
Дата
Msg-id 543BE9A4.1080401@dunslane.net
обсуждение исходный текст
Ответ на Re: JsonbValue to Jsonb conversion  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
On 10/13/2014 10:39 AM, Pavel Stehule wrote:
> Hi
>
> A JsonSemAction sem is not well initialized
>
> a array_element_start is not initialized and enforces sigfault on my comp
>
> *** ./utils/adt/jsonb.c.orig    2014-10-13 16:37:00.479708142 +0200
> --- ./utils/adt/jsonb.c    2014-10-13 16:36:33.704650644 +0200
> ***************
> *** 786,791 ****
> --- 786,793 ----
>                       sem.scalar = jsonb_in_scalar;
>                       sem.object_field_start = 
> jsonb_in_object_field_start;
>
> +                     sem.array_element_start = NULL;
> +
>                       pg_parse_json(lex, &sem);
>
>                   }
>
> I am not sure, if this fix is valid, but all tests are passed now
>
>

Good find. I think what we should probably do is initialize the whole 
thing with:
    memset(&sem, 0, sizeof(JsonSemAction));

before assigning anything to its fields. That would be consistent with 
what we do elsewhere.

I'll make that change and submit a new patch.

Please stop using this thread, however. It's inappropriate for reviewing 
this patch.

cheers

andrew



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [9.4 bug] The database server hangs with write-heavy workload on Windows
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: psql output change in 9.4