row_to_json(), NULL values, and AS
От | Neil Conway |
---|---|
Тема | row_to_json(), NULL values, and AS |
Дата | |
Msg-id | CAOW5sYa3Wp7KozCuzjOdw6PiOYPi6D=VvRybtH2S=2C0SVmRmA@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: row_to_json(), NULL values, and AS
|
Список | pgsql-bugs |
Hi, The following behavior does not seem self-consistent to me: postgres=# select json_agg(row_to_json(x)) from (select *, null from generate_series(1, 3)) x; json_agg ----------------------------------------------------------------------------------------------------------------------- [{"generate_series":1,"?column?":null}, {"generate_series":2,"?column?":null}, {"generate_series":3,"?column?":null}] (1 row) postgres=# select json_agg(row_to_json(x)) from (select *, row_to_json(null) as jjj from generate_series(1, 3)) x; json_agg -------------------------------------------------------------------------------------------------------- [{"generate_series":1,"jjj":null}, {"generate_series":2,"jjj":null}, {"generate_series":3,"jjj":null}] (1 row) postgres=# select json_agg(row_to_json(x)) from (select *, row_to_json(null) from generate_series(1, 3)) x; json_agg -------------------- [null, null, null] (1 row) In particular, it is unclear to me why removing the targetlist alias in the subquery in the third example should change the result set of the parent query. Thanks, Neil
В списке pgsql-bugs по дате отправления: