Re: proposal: ignore null fields in not relation type composite type based constructors

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: proposal: ignore null fields in not relation type composite type based constructors
Дата
Msg-id CAFj8pRCizZwv2yFMCQs6bVGofaELPY7tQx4sZs_WT1FVwj+Q3A@mail.gmail.com
обсуждение исходный текст
Ответ на proposal: ignore null fields in not relation type composite type based constructors  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: Re: proposal: ignore null fields in not relation type composite type based constructors
Список pgsql-hackers
Hello

I am sending small patch, that allows ignore nulls in row_to_json function. It allow significant size reduction of generated JSON documents.

Regards

Pavel




2014-05-25 7:53 GMT+02:00 Pavel Stehule <pavel.stehule@gmail.com>:
Hello

In Czech Postgres mailing list was user request for serialization to json without null values.

He needs a similar behave like XMLFOREST has - it ignores NULLs

In some situations and conversions, when your table is +/- sparse matrix, this request is valid

postgres=# select hstore(omega) from omega;
             hstore             
─────────────────────────────────
 "a"=>"10", "b"=>"20", "c"=>NULL
 "a"=>NULL, "b"=>"20", "c"=>"30"
(2 rows)

Proposed function

postgres=# select hstore(omega, ignore_nulls := true) from omega;
             hstore             
─────────────────────────────────
 "a"=>"10", "b"=>"20"
 "b"=>"20", "c"=>"30"
(2 rows)

What do you thinking about this proposal?

Regards

Pavel


Вложения

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

Предыдущее
От: Kevin Grittner
Дата:
Сообщение: Re: delta relations in AFTER triggers
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: better atomics - v0.5