mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 23:23:04 +01:00
Fixed CORE-1451 - Using RDB$DB_KEY in where section while selecting from a procedure crashes the server
This commit is contained in:
parent
598dd98134
commit
63de95f1d9
@ -3983,6 +3983,14 @@ static dsql_nod* pass1_dbkey( dsql_req* request, dsql_nod* input)
|
||||
if (request->req_context->getCount() == 1)
|
||||
{
|
||||
dsql_ctx* context = request->req_context->object();
|
||||
|
||||
if (!context->ctx_relation)
|
||||
{
|
||||
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
|
||||
isc_arg_gds, isc_dsql_dbkey_from_non_table,
|
||||
0);
|
||||
}
|
||||
|
||||
dsql_nod* node = MAKE_node(nod_dbkey, 1);
|
||||
dsql_nod* rel_node = MAKE_node(nod_relation, e_rel_count);
|
||||
rel_node->nod_arg[0] = (dsql_nod*) context;
|
||||
|
@ -3237,15 +3237,15 @@ static dsc* dbkey(thread_db* tdbb, const jrd_nod* node, impure_value* impure)
|
||||
impure = (impure_value*) ((SCHAR *) request + node->nod_impure);
|
||||
const record_param* rpb = &request->req_rpb[(int) (IPTR) node->nod_arg[0]];
|
||||
|
||||
const jrd_rel* relation = rpb->rpb_relation;
|
||||
|
||||
// If it doesn't point to a valid record, return NULL
|
||||
if (!rpb->rpb_number.isValid())
|
||||
if (!rpb->rpb_number.isValid() || !relation)
|
||||
{
|
||||
request->req_flags |= req_null;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const jrd_rel* relation = rpb->rpb_relation;
|
||||
|
||||
// Format dbkey as vector of relation id, record number
|
||||
|
||||
if (relation->rel_file) {
|
||||
|
Loading…
Reference in New Issue
Block a user