Re: Add jsonb_compact(...) for whitespace-free jsonb to text

Поиск
Список
Период
Сортировка
От Shulgin, Oleksandr
Тема Re: Add jsonb_compact(...) for whitespace-free jsonb to text
Дата
Msg-id CACACo5Tge6=Ta3LYz_QDPapnSw0vThECGP6H_8uynJE=d8bTMg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Add jsonb_compact(...) for whitespace-free jsonb to text  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: Add jsonb_compact(...) for whitespace-free jsonb to text  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
On Sun, May 1, 2016 at 3:22 AM, Andrew Dunstan <andrew@dunslane.net> wrote:

On 04/29/2016 06:11 PM, Merlin Moncure wrote:

This is a simple matter of removing spaces in the occasional C string
literal in the serialization routines and adding a json_pretty
function.

I spent a few hours on this. See <https://bitbucket.org/adunstan/pgdevel/commits/branch/jsonformat> for WIP - there are three commits. No regression tests yet for the two new functions (json_squash and json_pretty), Otherwise fairly complete. Removing whitespace generation was pretty simple for both json and jsonb.

Looks good, thank you!

It would make sense IMO to rename FormatState's `indent' field as `pretty': it's being used to add whitespace between the punctuation, not only at start of a line.  I'd also move the "if (indent)" check out of add_indent(): just don't call it if no indent is needed.

I'll try to play with the patch to produce some regression tests for the new functions.

--
Alex

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

Предыдущее
От: Daniel Gustafsson
Дата:
Сообщение: Subtle bug in autoconf flex version test
Следующее
От: Pavel Stehule
Дата:
Сообщение: what does function EmitWarningsOnPlaceholders?