diff --git a/src/jrd/Relation.h b/src/jrd/Relation.h index 080ae593c1..e97548a6bb 100644 --- a/src/jrd/Relation.h +++ b/src/jrd/Relation.h @@ -35,10 +35,12 @@ class ViewContext { public: explicit ViewContext(MemoryPool& p, const TEXT* context_name, - const TEXT* relation_name, USHORT context) : + const TEXT* relation_name, USHORT context, + bool is_relation) : vcx_context_name(p, context_name, strlen(context_name)), vcx_relation_name(relation_name), - vcx_context(context) + vcx_context(context), + vcx_is_relation(is_relation) { } @@ -50,6 +52,7 @@ public: const Firebird::string vcx_context_name; const Firebird::MetaName vcx_relation_name; const USHORT vcx_context; + const bool vcx_is_relation; }; typedef Firebird::SortedArray, diff --git a/src/jrd/met.epp b/src/jrd/met.epp index 2d2f926f1a..e1464205ab 100644 --- a/src/jrd/met.epp +++ b/src/jrd/met.epp @@ -4435,9 +4435,11 @@ static void lookup_view_contexts( thread_db* tdbb, jrd_rel* view) // trim trailing spaces fb_utils::exact_name_limit(V.RDB$CONTEXT_NAME, sizeof(V.RDB$CONTEXT_NAME)); + bool isProcedure = MET_lookup_procedure(tdbb, V.RDB$RELATION_NAME, true) != NULL; + ViewContext* view_context = FB_NEW(*dbb->dbb_permanent) - ViewContext(*dbb->dbb_permanent, - V.RDB$CONTEXT_NAME, V.RDB$RELATION_NAME, V.RDB$VIEW_CONTEXT); + ViewContext(*dbb->dbb_permanent, V.RDB$CONTEXT_NAME, V.RDB$RELATION_NAME, + V.RDB$VIEW_CONTEXT, !isProcedure); view->rel_view_contexts.add(view_context); diff --git a/src/jrd/tra.cpp b/src/jrd/tra.cpp index 65d2321ef0..dff30e91c9 100644 --- a/src/jrd/tra.cpp +++ b/src/jrd/tra.cpp @@ -2323,6 +2323,9 @@ static void expand_view_lock(thread_db* tdbb, jrd_tra* transaction, jrd_rel* rel for (size_t i = 0; i < ctx.getCount(); ++i) { + if (!ctx[i]->vcx_is_relation) + continue; + jrd_rel* base_rel = MET_lookup_relation(tdbb, ctx[i]->vcx_relation_name); if (!base_rel) {