mirror of
https://github.com/postgres/postgres.git
synced 2025-11-21 00:42:43 +03:00
Add soft error handling to some expression nodes
This adjusts the expression evaluation code for CoerceViaIO and CoerceToDomain to handle errors softly if needed. For CoerceViaIo, this means using InputFunctionCallSafe(), which provides the option to handle errors softly, instead of calling the type input function directly. For CoerceToDomain, this simply entails replacing the ereport() in ExecEvalConstraintCheck() by errsave(). In both cases, the ErrorSaveContext to be used when evaluating the expression is stored by ExecInitExprRec() in the expression's struct in the expression's ExprEvalStep. The ErrorSaveContext is passed by setting ExprState.escontext to point to it when calling ExecInitExprRec() on the expression whose errors are to be handled softly. Note that no call site of ExecInitExprRec() has been changed in this commit, so there's no functional change. This is intended for implementing new SQL/JSON expression nodes in future commits that will use to it suppress errors that may occur during type coercions. Reviewed-by: Álvaro Herrera Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com
This commit is contained in:
@@ -70,12 +70,14 @@ LLVMTypeRef StructHeapTupleTableSlot;
|
||||
LLVMTypeRef StructMinimalTupleTableSlot;
|
||||
LLVMTypeRef StructMemoryContextData;
|
||||
LLVMTypeRef StructFunctionCallInfoData;
|
||||
LLVMTypeRef StructFmgrInfo;
|
||||
LLVMTypeRef StructExprContext;
|
||||
LLVMTypeRef StructExprEvalStep;
|
||||
LLVMTypeRef StructExprState;
|
||||
LLVMTypeRef StructAggState;
|
||||
LLVMTypeRef StructAggStatePerGroupData;
|
||||
LLVMTypeRef StructAggStatePerTransData;
|
||||
LLVMTypeRef StructErrorSaveContext;
|
||||
|
||||
LLVMValueRef AttributeTemplate;
|
||||
|
||||
@@ -1118,6 +1120,7 @@ llvm_create_types(void)
|
||||
StructExprEvalStep = llvm_pg_var_type("StructExprEvalStep");
|
||||
StructExprState = llvm_pg_var_type("StructExprState");
|
||||
StructFunctionCallInfoData = llvm_pg_var_type("StructFunctionCallInfoData");
|
||||
StructFmgrInfo = llvm_pg_var_type("StructFmgrInfo");
|
||||
StructMemoryContextData = llvm_pg_var_type("StructMemoryContextData");
|
||||
StructTupleTableSlot = llvm_pg_var_type("StructTupleTableSlot");
|
||||
StructHeapTupleTableSlot = llvm_pg_var_type("StructHeapTupleTableSlot");
|
||||
@@ -1127,6 +1130,7 @@ llvm_create_types(void)
|
||||
StructAggState = llvm_pg_var_type("StructAggState");
|
||||
StructAggStatePerGroupData = llvm_pg_var_type("StructAggStatePerGroupData");
|
||||
StructAggStatePerTransData = llvm_pg_var_type("StructAggStatePerTransData");
|
||||
StructErrorSaveContext = llvm_pg_var_type("StructErrorSaveContext");
|
||||
|
||||
AttributeTemplate = LLVMGetNamedFunction(llvm_types_module, "AttributeTemplate");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user