Re: [PATCH] hstore_to_json: empty hstores must return empty json objects
В списке pgsql-hackers по дате отправления:
| От | Oskari Saarenmaa |
|---|---|
| Тема | Re: [PATCH] hstore_to_json: empty hstores must return empty json objects |
| Дата | |
| Msg-id | 525FF618.2070409@ohmu.fi обсуждение исходный текст |
| Ответ на | Re: [PATCH] hstore_to_json: empty hstores must return empty json objects (Alvaro Herrera <alvherre@2ndquadrant.com>) |
| Список | pgsql-hackers |
On 17/10/13 17:23, Alvaro Herrera wrote:
> Oskari Saarenmaa wrote:
>
>> @@ -1241,8 +1241,8 @@ hstore_to_json_loose(PG_FUNCTION_ARGS)
>>
>> if (count == 0)
>> {
>> - out = palloc(1);
>> - *out = '\0';
>> + out = palloc(3);
>> + memcpy(out, "{}", 3);
>> PG_RETURN_TEXT_P(cstring_to_text(out));
>> }
>
> Can't you just PG_RETURN_TEXT_P(cstring_to_text("{}")) ?
>
I'm not too familiar with PG internals and just modified this to work
like it did before, but it looks like the extra allocation is indeed
unnecessary.
I can post a new patch to make this use cstring_to_text_with_len("{}",
2) (to avoid an unnecessary strlen call) or you can just make the change
and push the modified version.
Thanks, Oskari
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера