diff --git a/src/dsql/DdlNodes.epp b/src/dsql/DdlNodes.epp index 986b3c0a6f..75a061f77c 100644 --- a/src/dsql/DdlNodes.epp +++ b/src/dsql/DdlNodes.epp @@ -5536,7 +5536,7 @@ void RelationNode::defineField(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch if (clause->identity) { dsc desc; - MET_get_domain(tdbb, fieldDefinition.fieldSource, &desc, NULL); + MET_get_domain(tdbb, *tdbb->getDefaultPool(), fieldDefinition.fieldSource, &desc, NULL); if (!desc.isExact() || desc.dsc_scale != 0) { diff --git a/src/dsql/ExprNodes.cpp b/src/dsql/ExprNodes.cpp index b8a54537dc..55b9023c07 100644 --- a/src/dsql/ExprNodes.cpp +++ b/src/dsql/ExprNodes.cpp @@ -4576,7 +4576,7 @@ DmlNode* FieldNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* cs } DomainValidationNode* domNode = FB_NEW(pool) DomainValidationNode(pool); - MET_get_domain(tdbb, csb->csb_domain_validation, &domNode->domDesc, NULL); + MET_get_domain(tdbb, csb->csb_pool, csb->csb_domain_validation, &domNode->domDesc, NULL); // Cast to the target type - see CORE-3545. CastNode* castNode = FB_NEW(pool) CastNode(pool); diff --git a/src/dsql/dsql.h b/src/dsql/dsql.h index 3a51d5c9a9..1cf43376fb 100644 --- a/src/dsql/dsql.h +++ b/src/dsql/dsql.h @@ -211,7 +211,7 @@ public: typeOfName(pool), collate(pool, aCollate), charSet(pool), - subTypeName(NULL), + subTypeName(pool, NULL), flags(0), elementDtype(0), elementLength(0), diff --git a/src/jrd/ExtEngineManager.cpp b/src/jrd/ExtEngineManager.cpp index fffb9a3df3..81d7e35b47 100644 --- a/src/jrd/ExtEngineManager.cpp +++ b/src/jrd/ExtEngineManager.cpp @@ -91,7 +91,8 @@ namespace FieldInfo fieldInfo; bool exist = csb->csb_map_field_info.get(namePair, fieldInfo); - MET_get_domain(tdbb, param->prm_field_source, desc, (exist ? NULL : &fieldInfo)); + MET_get_domain(tdbb, csb->csb_pool, param->prm_field_source, desc, + (exist ? NULL : &fieldInfo)); if (!exist) csb->csb_map_field_info.put(namePair, fieldInfo); diff --git a/src/jrd/met.epp b/src/jrd/met.epp index cc0277dddc..64c3b0a21a 100644 --- a/src/jrd/met.epp +++ b/src/jrd/met.epp @@ -182,7 +182,8 @@ static void post_used_procedures(trig_vec* vector) } -void MET_get_domain(thread_db* tdbb, const MetaName& name, dsc* desc, FieldInfo* fieldInfo) +void MET_get_domain(thread_db* tdbb, MemoryPool& csbPool, const MetaName& name, dsc* desc, + FieldInfo* fieldInfo) { /************************************** * @@ -217,27 +218,19 @@ void MET_get_domain(thread_db* tdbb, const MetaName& name, dsc* desc, FieldInfo* { fieldInfo->nullable = FLD.RDB$NULL_FLAG.NULL || FLD.RDB$NULL_FLAG == 0; - MemoryPool* csb_pool = attachment->createPool(); - Jrd::ContextPoolHolder context(tdbb, csb_pool); - try - { - if (FLD.RDB$DEFAULT_VALUE.NULL) - fieldInfo->defaultValue = NULL; - else - fieldInfo->defaultValue = parse_field_default_blr(tdbb, &FLD.RDB$DEFAULT_VALUE); + Jrd::ContextPoolHolder context(tdbb, &csbPool); - if (FLD.RDB$VALIDATION_BLR.NULL) - fieldInfo->validationExpr = NULL; - else - { - fieldInfo->validationExpr = parse_field_validation_blr(tdbb, - &FLD.RDB$VALIDATION_BLR, name); - } - } - catch (const Exception&) + if (FLD.RDB$DEFAULT_VALUE.NULL) + fieldInfo->defaultValue = NULL; + else + fieldInfo->defaultValue = parse_field_default_blr(tdbb, &FLD.RDB$DEFAULT_VALUE); + + if (FLD.RDB$VALIDATION_BLR.NULL) + fieldInfo->validationExpr = NULL; + else { - attachment->deletePool(csb_pool); - throw; + fieldInfo->validationExpr = parse_field_validation_blr(tdbb, + &FLD.RDB$VALIDATION_BLR, name); } } } @@ -251,11 +244,8 @@ void MET_get_domain(thread_db* tdbb, const MetaName& name, dsc* desc, FieldInfo* } -MetaName MET_get_relation_field(thread_db* tdbb, - const MetaName& relationName, - const MetaName& fieldName, - dsc* desc, - FieldInfo* fieldInfo) +MetaName MET_get_relation_field(thread_db* tdbb, MemoryPool& csbPool, const MetaName& relationName, + const MetaName& fieldName, dsc* desc, FieldInfo* fieldInfo) { /************************************** * @@ -298,34 +288,25 @@ MetaName MET_get_relation_field(thread_db* tdbb, fieldInfo->nullable = RFL.RDB$NULL_FLAG.NULL ? (FLD.RDB$NULL_FLAG.NULL || FLD.RDB$NULL_FLAG == 0) : RFL.RDB$NULL_FLAG == 0; - MemoryPool* csb_pool = attachment->createPool(); - Jrd::ContextPoolHolder context(tdbb, csb_pool); - try + Jrd::ContextPoolHolder context(tdbb, &csbPool); + bid* defaultId = NULL; + + if (!RFL.RDB$DEFAULT_VALUE.NULL) + defaultId = &RFL.RDB$DEFAULT_VALUE; + else if (!FLD.RDB$DEFAULT_VALUE.NULL) + defaultId = &FLD.RDB$DEFAULT_VALUE; + + if (defaultId) + fieldInfo->defaultValue = parse_field_default_blr(tdbb, defaultId); + else + fieldInfo->defaultValue = NULL; + + if (FLD.RDB$VALIDATION_BLR.NULL) + fieldInfo->validationExpr = NULL; + else { - bid* defaultId = NULL; - - if (!RFL.RDB$DEFAULT_VALUE.NULL) - defaultId = &RFL.RDB$DEFAULT_VALUE; - else if (!FLD.RDB$DEFAULT_VALUE.NULL) - defaultId = &FLD.RDB$DEFAULT_VALUE; - - if (defaultId) - fieldInfo->defaultValue = parse_field_default_blr(tdbb, defaultId); - else - fieldInfo->defaultValue = NULL; - - if (FLD.RDB$VALIDATION_BLR.NULL) - fieldInfo->validationExpr = NULL; - else - { - fieldInfo->validationExpr = parse_field_validation_blr(tdbb, - &FLD.RDB$VALIDATION_BLR, RFL.RDB$FIELD_SOURCE); - } - } - catch (const Exception&) - { - attachment->deletePool(csb_pool); - throw; + fieldInfo->validationExpr = parse_field_validation_blr(tdbb, + &FLD.RDB$VALIDATION_BLR, RFL.RDB$FIELD_SOURCE); } } } diff --git a/src/jrd/met_proto.h b/src/jrd/met_proto.h index b4f952ef9e..b956bb684b 100644 --- a/src/jrd/met_proto.h +++ b/src/jrd/met_proto.h @@ -124,9 +124,10 @@ void MET_scan_relation(Jrd::thread_db*, Jrd::jrd_rel*); void MET_trigger_msg(Jrd::thread_db*, Firebird::string&, const Firebird::MetaName&, USHORT); void MET_update_shadow(Jrd::thread_db*, Jrd::Shadow*, USHORT); void MET_update_transaction(Jrd::thread_db*, Jrd::jrd_tra*, const bool); -void MET_get_domain(Jrd::thread_db*, const Firebird::MetaName&, dsc*, Jrd::FieldInfo*); -Firebird::MetaName MET_get_relation_field(Jrd::thread_db*, const Firebird::MetaName&, - const Firebird::MetaName&, dsc*, Jrd::FieldInfo*); +void MET_get_domain(Jrd::thread_db*, MemoryPool& csbPool, const Firebird::MetaName&, dsc*, + Jrd::FieldInfo*); +Firebird::MetaName MET_get_relation_field(Jrd::thread_db*, MemoryPool& csbPool, + const Firebird::MetaName&, const Firebird::MetaName&, dsc*, Jrd::FieldInfo*); void MET_update_partners(Jrd::thread_db*); #endif // JRD_MET_PROTO_H diff --git a/src/jrd/par.cpp b/src/jrd/par.cpp index 29f157653d..2279d38509 100644 --- a/src/jrd/par.cpp +++ b/src/jrd/par.cpp @@ -480,7 +480,7 @@ USHORT PAR_desc(thread_db* tdbb, CompilerScratch* csb, dsc* desc, ItemInfo* item FieldInfo fieldInfo; bool exist = csb->csb_map_field_info.get(namePair, fieldInfo); - MET_get_domain(tdbb, *name, desc, (exist ? NULL : &fieldInfo)); + MET_get_domain(tdbb, csb->csb_pool, *name, desc, (exist ? NULL : &fieldInfo)); if (!exist) csb->csb_map_field_info.put(namePair, fieldInfo); @@ -541,7 +541,8 @@ USHORT PAR_desc(thread_db* tdbb, CompilerScratch* csb, dsc* desc, ItemInfo* item FieldInfo fieldInfo; bool exist = csb->csb_map_field_info.get(namePair, fieldInfo); - MET_get_relation_field(tdbb, *relationName, *fieldName, desc, (exist ? NULL : &fieldInfo)); + MET_get_relation_field(tdbb, csb->csb_pool, *relationName, *fieldName, desc, + (exist ? NULL : &fieldInfo)); if (!exist) csb->csb_map_field_info.put(namePair, fieldInfo);