Skip to content

Commit f693bf4

Browse files
committed
Fix problem with COMMENT ON. Thanks Pavel Zotov.
1 parent 7035d6e commit f693bf4

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

src/dsql/DdlNodes.epp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@ DdlNode* CommentOnNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
13331333
fb_assert(subName.hasData());
13341334

13351335
auto nameCopy = name;
1336-
dsqlScratch->qualifyExistingName(nameCopy, obj_udf);
1336+
dsqlScratch->resolveRoutineOrRelation(nameCopy, {obj_udf});
13371337

13381338
static const CachedRequestId funcCachedHandleId;
13391339
AutoCacheRequest requestHandle(tdbb, funcCachedHandleId);
@@ -1354,7 +1354,7 @@ DdlNode* CommentOnNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
13541354
END_FOR
13551355

13561356
nameCopy = name;
1357-
dsqlScratch->qualifyExistingName(nameCopy, obj_procedure);
1357+
dsqlScratch->resolveRoutineOrRelation(nameCopy, {obj_procedure});
13581358

13591359
static const CachedRequestId procCachedHandleId;
13601360
requestHandle.reset(tdbb, procCachedHandleId);
@@ -1389,8 +1389,6 @@ DdlNode* CommentOnNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
13891389
name = nameCopy;
13901390
}
13911391

1392-
dsqlScratch->ddlSchema = name.schema;
1393-
13941392
switch (objType)
13951393
{
13961394
case obj_database:
@@ -1400,11 +1398,18 @@ DdlNode* CommentOnNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
14001398
fb_assert(name.schema.isEmpty());
14011399
break;
14021400

1401+
case obj_procedure:
1402+
case obj_udf:
1403+
dsqlScratch->resolveRoutineOrRelation(name, {objType});
1404+
break;
1405+
14031406
default:
14041407
dsqlScratch->qualifyExistingName(name, objType);
14051408
break;
14061409
}
14071410

1411+
dsqlScratch->ddlSchema = name.schema;
1412+
14081413
return DdlNode::dsqlPass(dsqlScratch);
14091414
}
14101415

@@ -1503,8 +1508,7 @@ void CommentOnNode::checkPermission(thread_db* tdbb, jrd_tra* transaction)
15031508
// gives the list of objects that accept descriptions. At FB2 time, the only
15041509
// subobjects with descriptions are relation's fields and procedure's parameters.
15051510
// In FB3 we added function's arguments.
1506-
void CommentOnNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
1507-
jrd_tra* transaction)
1511+
void CommentOnNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd_tra* transaction)
15081512
{
15091513
Attachment* const attachment = transaction->tra_attachment;
15101514

src/dsql/DdlNodes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ class AlterEDSPoolClearNode final : public DdlNode
351351
class CommentOnNode final : public DdlNode
352352
{
353353
public:
354-
CommentOnNode(MemoryPool& pool, int aObjType,
354+
CommentOnNode(MemoryPool& pool, ObjectType aObjType,
355355
const QualifiedName& aName, const MetaName& aSubName,
356356
const Firebird::string aText)
357357
: DdlNode(pool),
@@ -381,7 +381,7 @@ class CommentOnNode final : public DdlNode
381381
}
382382

383383
private:
384-
int objType;
384+
ObjectType objType;
385385
QualifiedName name;
386386
MetaName subName;
387387
Firebird::string text, str;

src/dsql/parse.y

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6161,9 +6161,9 @@ comment
61616161
{ $$ = newNode<CommentOnNode>($3, QualifiedName(*$4), "", *$6); }
61626162
| COMMENT ON COLUMN symbol_ddl_name '.' valid_symbol_name IS ddl_desc
61636163
{ $$ = newNode<CommentOnNode>(obj_relation, *$4, *$6, *$8); }
6164-
| COMMENT ON ddl_type3 qualified_name '.' valid_symbol_name IS ddl_desc
6164+
| COMMENT ON ddl_type3 scoped_qualified_name '.' valid_symbol_name IS ddl_desc
61656165
{ $$ = newNode<CommentOnNode>($3, *$4, *$6, *$8); }
6166-
| COMMENT ON ddl_type4 qualified_name IS ddl_desc
6166+
| COMMENT ON ddl_type4 scoped_qualified_name IS ddl_desc
61676167
{ $$ = newNode<CommentOnNode>($3, *$4, "", *$6); }
61686168
| comment_on_user
61696169
{ $$ = $1; }

0 commit comments

Comments
 (0)