Re: Extract numeric filed in JSONB more effectively
Andy Fan <zhihui.fan1213@gmail.com>
From: Andy Fan <zhihui.fan1213@gmail.com>
To: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2023-08-01T23:33:37Z
Lists: pgsql-hackers
On Tue, Aug 1, 2023 at 7:03 PM Matthias van de Meent < boekewurm+postgres@gmail.com> wrote: > On Tue, 1 Aug 2023 at 06:39, Andy Fan <zhihui.fan1213@gmail.com> wrote: > > > > Hi: > > > > Currently if we want to extract a numeric field in jsonb, we need to use > > the following expression: cast (a->>'a' as numeric). It will turn a > numeric > > to text first and then turn the text to numeric again. > > Why wouldn't you use cast(a->'a' as numeric), or ((a->'a')::numeric)? > Thanks for this information! I didn't realize we have this function already at [1]. https://www.postgresql.org/docs/15/functions-json.html -- Best Regards Andy Fan
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add trailing commas to enum definitions
- 611806cd726f 17.0 cited