@@ -12321,6 +12321,23 @@ DmlNode* SysFuncCallNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScrat
1232112321
1232212322 node->args = PAR_args (tdbb, csb);
1232312323
12324+ if (name == " MAKE_DBKEY" )
12325+ {
12326+ // Special handling for system function MAKE_DBKEY:
12327+ // convert constant relation name into ID at the parsing time
12328+
12329+ auto literal = nodeAs<LiteralNode>(node->args ->items [0 ]);
12330+
12331+ if (literal && literal->litDesc .isText ())
12332+ {
12333+ const MetaName relName = literal->getText ();
12334+ const jrd_rel* const relation = MET_lookup_relation (tdbb, relName);
12335+
12336+ if (relation)
12337+ node->args ->items [0 ] = MAKE_const_slong (relation->rel_id );
12338+ }
12339+ }
12340+
1232412341 return node;
1232512342}
1232612343
@@ -12462,32 +12479,6 @@ ValueExprNode* SysFuncCallNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
1246212479
1246312480 if (node->function )
1246412481 {
12465- if (name == " MAKE_DBKEY" )
12466- {
12467- // Special handling for system function MAKE_DBKEY:
12468- // convert constant relation name into ID at the parsing time
12469-
12470- auto literal = nodeAs<LiteralNode>(node->args ->items [0 ]);
12471-
12472- if (literal && literal->litDesc .isText ())
12473- {
12474- const MetaName relName = literal->getText ();
12475-
12476- const dsql_rel* const relation =
12477- METD_get_relation (dsqlScratch->getTransaction (), dsqlScratch, relName);
12478-
12479- if (!relation)
12480- {
12481- status_exception::raise (
12482- Arg::Gds (isc_sqlerr) << Arg::Num (-607 ) <<
12483- Arg::Gds (isc_dsql_command_err) <<
12484- Arg::Gds (isc_dsql_table_not_found) << relName);
12485- }
12486-
12487- node->args ->items [0 ] = MAKE_const_slong (relation->rel_id );
12488- }
12489- }
12490-
1249112482 if (node->function ->setParamsFunc )
1249212483 {
1249312484 Array<dsc> tempDescs (node->args ->items .getCount ());
0 commit comments