Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9b058f6

Browse files
committed
Move ExecEvalJsonConstructor new function to a more natural place
Commit7081ac4 put it at the end of the file, but that doesn't lookvery nice.
1 parent47a9709 commit9b058f6

File tree

2 files changed

+39
-39
lines changed

2 files changed

+39
-39
lines changed

‎src/backend/executor/execExprInterp.c

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3884,6 +3884,43 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op)
38843884
}
38853885
}
38863886

3887+
/*
3888+
* Evaluate a JSON constructor expression.
3889+
*/
3890+
void
3891+
ExecEvalJsonConstructor(ExprState*state,ExprEvalStep*op,
3892+
ExprContext*econtext)
3893+
{
3894+
Datumres;
3895+
JsonConstructorExprState*jcstate=op->d.json_constructor.jcstate;
3896+
JsonConstructorExpr*ctor=jcstate->constructor;
3897+
boolis_jsonb=ctor->returning->format->format_type==JS_FORMAT_JSONB;
3898+
boolisnull= false;
3899+
3900+
if (ctor->type==JSCTOR_JSON_ARRAY)
3901+
res= (is_jsonb ?
3902+
jsonb_build_array_worker :
3903+
json_build_array_worker) (jcstate->nargs,
3904+
jcstate->arg_values,
3905+
jcstate->arg_nulls,
3906+
jcstate->arg_types,
3907+
jcstate->constructor->absent_on_null);
3908+
elseif (ctor->type==JSCTOR_JSON_OBJECT)
3909+
res= (is_jsonb ?
3910+
jsonb_build_object_worker :
3911+
json_build_object_worker) (jcstate->nargs,
3912+
jcstate->arg_values,
3913+
jcstate->arg_nulls,
3914+
jcstate->arg_types,
3915+
jcstate->constructor->absent_on_null,
3916+
jcstate->constructor->unique);
3917+
else
3918+
elog(ERROR,"invalid JsonConstructorExpr type %d",ctor->type);
3919+
3920+
*op->resvalue=res;
3921+
*op->resnull=isnull;
3922+
}
3923+
38873924
/*
38883925
* ExecEvalGroupingFunc
38893926
*
@@ -4447,40 +4484,3 @@ ExecAggPlainTransByRef(AggState *aggstate, AggStatePerTrans pertrans,
44474484

44484485
MemoryContextSwitchTo(oldContext);
44494486
}
4450-
4451-
/*
4452-
* Evaluate a JSON constructor expression.
4453-
*/
4454-
void
4455-
ExecEvalJsonConstructor(ExprState*state,ExprEvalStep*op,
4456-
ExprContext*econtext)
4457-
{
4458-
Datumres;
4459-
JsonConstructorExprState*jcstate=op->d.json_constructor.jcstate;
4460-
JsonConstructorExpr*ctor=jcstate->constructor;
4461-
boolis_jsonb=ctor->returning->format->format_type==JS_FORMAT_JSONB;
4462-
boolisnull= false;
4463-
4464-
if (ctor->type==JSCTOR_JSON_ARRAY)
4465-
res= (is_jsonb ?
4466-
jsonb_build_array_worker :
4467-
json_build_array_worker) (jcstate->nargs,
4468-
jcstate->arg_values,
4469-
jcstate->arg_nulls,
4470-
jcstate->arg_types,
4471-
jcstate->constructor->absent_on_null);
4472-
elseif (ctor->type==JSCTOR_JSON_OBJECT)
4473-
res= (is_jsonb ?
4474-
jsonb_build_object_worker :
4475-
json_build_object_worker) (jcstate->nargs,
4476-
jcstate->arg_values,
4477-
jcstate->arg_nulls,
4478-
jcstate->arg_types,
4479-
jcstate->constructor->absent_on_null,
4480-
jcstate->constructor->unique);
4481-
else
4482-
elog(ERROR,"invalid JsonConstructorExpr type %d",ctor->type);
4483-
4484-
*op->resvalue=res;
4485-
*op->resnull=isnull;
4486-
}

‎src/include/executor/execExpr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,15 +787,15 @@ extern void ExecEvalHashedScalarArrayOp(ExprState *state, ExprEvalStep *op,
787787
externvoidExecEvalConstraintNotNull(ExprState*state,ExprEvalStep*op);
788788
externvoidExecEvalConstraintCheck(ExprState*state,ExprEvalStep*op);
789789
externvoidExecEvalXmlExpr(ExprState*state,ExprEvalStep*op);
790+
externvoidExecEvalJsonConstructor(ExprState*state,ExprEvalStep*op,
791+
ExprContext*econtext);
790792
externvoidExecEvalGroupingFunc(ExprState*state,ExprEvalStep*op);
791793
externvoidExecEvalSubPlan(ExprState*state,ExprEvalStep*op,
792794
ExprContext*econtext);
793795
externvoidExecEvalWholeRowVar(ExprState*state,ExprEvalStep*op,
794796
ExprContext*econtext);
795797
externvoidExecEvalSysVar(ExprState*state,ExprEvalStep*op,
796798
ExprContext*econtext,TupleTableSlot*slot);
797-
externvoidExecEvalJsonConstructor(ExprState*state,ExprEvalStep*op,
798-
ExprContext*econtext);
799799

800800
externvoidExecAggInitGroup(AggState*aggstate,AggStatePerTranspertrans,AggStatePerGrouppergroup,
801801
ExprContext*aggcontext);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp