Re: Extract numeric filed in JSONB more effectively

Dmitry Dolgov <9erthalion6@gmail.com>

From: Dmitry Dolgov <9erthalion6@gmail.com>
To: Haibo Yan <tristan.yim@gmail.com>
Cc: David Rowley <dgrowleyml@gmail.com>, Andy Fan <zhihuifan1213@163.com>, Peter Eisentraut <peter@eisentraut.org>, Amit Langote <amitlangote09@gmail.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, jian he <jian.universality@gmail.com>, Chapman Flack <chap@anastigmatix.net>, pgsql-hackers@lists.postgresql.org
Date: 2026-04-06T13:05:37Z
Lists: pgsql-hackers
> On Fri, Apr 03, 2026 at 09:42:20AM -0700, Haibo Yan wrote:

Thanks for picking it up, the patch looks good.

> One small thing: the UI looks a bit odd on my side. It does not seem to have picked my attachment, and is instead showing your older attachment there. But cfbot appears to have picked up mine, so I think it may just be a UI issue.

It takes some time, as far as I can see currently the correct patch is shown.

> +		/*
> +		 * Identify the inner extraction expression.  It may appear as
> +		 * either a FuncExpr or an OpExpr; accept both forms.
> +		 */
> +		if (IsA(arg, FuncExpr))
> +		{
> +			FuncExpr   *inner = (FuncExpr *) arg;
> +
> +			inner_funcid = inner->funcid;
> +			inner_args = inner->args;
> +			location = inner->location;
> +		}
> +		else if (IsA(arg, OpExpr))
> +		{
> +			OpExpr	   *inner = (OpExpr *) arg;
> +
> +			inner_funcid = inner->opfuncid;
> +			inner_args = inner->args;
> +			location = inner->location;
> +		}
> +		else
> +			PG_RETURN_POINTER(NULL);

It may also appear as a SubscriptingRef expression if we use subscription over
jsonb.

	SELECT test_json['field7']::bool FROM test_jsonb WHERE json_type = 'object';

Seems to be worth handling this case as well, since it doesn't lead to an
interface explosion.



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add trailing commas to enum definitions