Skip to content

Commit

Permalink
Fixed CORE-5130 - Compiler issues message about "invalid request BLR"…
Browse files Browse the repository at this point in the history
… when attempt to compile wrong DDL of view with both subquery and "WITH CHECK OPTION" in its DDL.
  • Loading branch information
asfernandes committed Mar 9, 2016
1 parent 71f4da0 commit 152b6bd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/dsql/BoolNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1674,6 +1674,12 @@ string RseBoolNode::internalPrint(NodePrinter& printer) const

BoolExprNode* RseBoolNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
{
if (dsqlScratch->flags & DsqlCompilerScratch::FLAG_VIEW_WITH_CHECK)
{
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_subquery_err));
}

const DsqlContextStack::iterator base(*dsqlScratch->context);

RseBoolNode* node = FB_NEW_POOL(getPool()) RseBoolNode(getPool(), blrOp,
Expand Down
2 changes: 2 additions & 0 deletions src/dsql/DdlNodes.epp
Original file line number Diff line number Diff line change
Expand Up @@ -8825,6 +8825,8 @@ void CreateAlterViewNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScra
Arg::Gds(isc_distinct_err));
}

dsqlScratch->flags |= DsqlCompilerScratch::FLAG_VIEW_WITH_CHECK;

createCheckTrigger(tdbb, dsqlScratch, items, PRE_MODIFY_TRIGGER);
createCheckTrigger(tdbb, dsqlScratch, items, PRE_STORE_TRIGGER);
}
Expand Down
1 change: 1 addition & 0 deletions src/dsql/DsqlCompilerScratch.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class DsqlCompilerScratch : public BlrDebugWriter
static const unsigned FLAG_AMBIGUOUS_STMT = 0x1000;
static const unsigned FLAG_DDL = 0x2000;
static const unsigned FLAG_FETCH = 0x4000;
static const unsigned FLAG_VIEW_WITH_CHECK = 0x8000;

static const unsigned MAX_NESTING = 512;

Expand Down
6 changes: 6 additions & 0 deletions src/dsql/ExprNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9210,6 +9210,12 @@ string SubQueryNode::internalPrint(NodePrinter& printer) const

ValueExprNode* SubQueryNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
{
if (dsqlScratch->flags & DsqlCompilerScratch::FLAG_VIEW_WITH_CHECK)
{
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-607) <<
Arg::Gds(isc_subquery_err));
}

const DsqlContextStack::iterator base(*dsqlScratch->context);

RseNode* rse = PASS1_rse(dsqlScratch, dsqlRse->as<SelectExprNode>(), false);
Expand Down

0 comments on commit 152b6bd

Please sign in to comment.