diff --git a/src/jrd/err.cpp b/src/jrd/err.cpp index b7b999a77c..641e9f894f 100644 --- a/src/jrd/err.cpp +++ b/src/jrd/err.cpp @@ -371,7 +371,8 @@ void ERR_warning(const Arg::StatusVector& v) FbStatusVector* s = tdbb->tdbb_status_vector; v.copyTo(s); - tdbb->getRequest()->req_flags |= req_warning; + if (jrd_req* request = tdbb->getRequest()) + request->req_flags |= req_warning; } diff --git a/src/jrd/opt.cpp b/src/jrd/opt.cpp index 5ae19a9d52..c7660b37ea 100644 --- a/src/jrd/opt.cpp +++ b/src/jrd/opt.cpp @@ -1013,10 +1013,15 @@ static void check_indices(const CompilerScratch::csb_repeat* csb_tail) // if there were no indices fetched at all but the // user specified some, error out using the first index specified - if (!csb_tail->csb_indices && plan->accessType && !tdbb->getAttachment()->isGbak()) + const bool isGbak = tdbb->getAttachment()->isGbak(); + + if (!csb_tail->csb_indices && plan->accessType) { // index %s cannot be used in the specified plan - ERR_post(Arg::Gds(isc_index_unused) << plan->accessType->items[0].indexName); + if (isGbak) + ERR_post_warning(Arg::Warning(isc_index_unused) << plan->accessType->items[0].indexName); + else + ERR_post(Arg::Gds(isc_index_unused) << plan->accessType->items[0].indexName); } // check to make sure that all indices are either used or marked not to be used, @@ -1036,7 +1041,10 @@ static void check_indices(const CompilerScratch::csb_repeat* csb_tail) index_name = ""; // index %s cannot be used in the specified plan - ERR_post(Arg::Gds(isc_index_unused) << Arg::Str(index_name)); + if (isGbak) + ERR_post_warning(Arg::Warning(isc_index_unused) << Arg::Str(index_name)); + else + ERR_post(Arg::Gds(isc_index_unused) << Arg::Str(index_name)); } ++idx; diff --git a/src/jrd/par.cpp b/src/jrd/par.cpp index c0b47d81d9..d6bcaa0cef 100644 --- a/src/jrd/par.cpp +++ b/src/jrd/par.cpp @@ -1694,17 +1694,7 @@ void PAR_warning(const Arg::StatusVector& v) * **************************************/ fb_assert(v.value()[0] == isc_arg_warning); - - thread_db* tdbb = JRD_get_thread_data(); - - // Make sure that the [1] position is 0 indicating that no error has occurred - Arg::Gds p(FB_SUCCESS); - - // Now place your warning messages - p.append(v); - - // Save into tdbb - p.copyTo(tdbb->tdbb_status_vector); + ERR_post_warning(v); }