Search Postgresql Archives

Re: change JSON serialization for BIGINT?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



вт, 26 нояб. 2024 г. в 14:34, Tim McLaughlin <tim@xxxxxxxx>:
Is there a way to have Postgres serialize BIGINT as a string rather than number in JSON?  By default it does this:


select row_to_json(row(500::bigint));
 row_to_json 
-------------
 {"f1":500}

But I want it to do this (note that "500" is quoted):

select row_to_json(row(500::bigint));
 row_to_json 
-------------
 {"f1":"500"}

Will this work?

select row_to_json(row(500::text));

--
Victor Yegorov

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux