| От | Raymond O'Donnell |
|---|---|
| Тема | Re: Bypassing NULL elements in row_to_json function |
| Дата | |
| Msg-id | 5707D40A.3080102@iol.ie обсуждение исходный текст |
| Ответ на | Bypassing NULL elements in row_to_json function (Michael Nolan <htfoot@gmail.com>) |
| Ответы |
Re: Bypassing NULL elements in row_to_json function
|
| Список | pgsql-general |
On 08/04/2016 16:31, Michael Nolan wrote: > I'm looking at the possibility of using JSON as a data exchange format > with some apps running on both PCs and Macs. . > > The table I would be exporting has a lot of NULL values in it. Is > there any way to skip the NULL values in the row_to_json function and > include only the fields that are non-null? You could use a CTE to filter out the nulls (not tested - I haven't used JSON in PG (yet!)): with no_nulls as ( select ... from my_table where whatever is not null ) select row_to_json(....) from no_nulls; Ray. -- Raymond O'Donnell :: Galway :: Ireland rod@iol.ie
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера