模式的删除与dodeletion

简介:
复制代码
/*                            
 * doDeletion: actually delete a single object                            
 */                            
static void                            
doDeletion(const ObjectAddress *object, int flags)                            
{                            
    switch (getObjectClass(object))                        
    {                        
        ……                    
        case OCLASS_SCHEMA:                    
            RemoveSchemaById(object->objectId);                
            break;                
                            
        ……                    
        default:                    
            elog(ERROR, "unrecognized object class: %u",                
                 object->classId);            
    }                        
}                            
复制代码

而它又是被 depency.c 中的 deleteOneObject 调用

复制代码
/*                            
 * deleteOneObject: delete a single object for performDeletion.                            
 *                            
 * depRel is the already-open pg_depend relation.                            
 */                            
static void                            
deleteOneObject(const ObjectAddress *object, Relation depRel, int flags)                            
{                            
    ……                        
    /*                        
     * Now delete the object itself, in an object-type-dependent way.                        
     */                        
    doDeletion(object, flags);                        
                            
    ……                        
    /*                        
     * And we're done!                        
     */                        
}                            
复制代码

而它又是被 performDeletion 所调用:

复制代码
/*                            
 * performDeletion: attempt to drop the specified object.  If CASCADE                            
 * behavior is specified, also drop any dependent objects (recursively).                            
 * If RESTRICT behavior is specified, error out if there are any dependent                            
 * objects, except for those that should be implicitly dropped anyway                            
 * according to the dependency type.                            
 *                            
 * This is the outer control routine for all forms of DROP that drop objects                            
 * that can participate in dependencies.  Note that the next two routines                            
 * are variants on the same theme; if you change anything here you'll likely                            
 * need to fix them too.                            
 *                            
 * flags should include PERFORM_DELETION_INTERNAL when the drop operation is                            
 * not the direct result of a user-initiated action.  For example, when a                            
 * temporary schema is cleaned out so that a new backend can use it, or when                            
 * a column default is dropped as an intermediate step while adding a new one,                            
 * that's an internal operation.  On the other hand, when the we drop something                            
 * because the user issued a DROP statement against it, that's not internal.                            
 */                            
void                            
performDeletion(const ObjectAddress *object,                            
                DropBehavior behavior, int flags)            
{                            
    ……                        
    /*                        
     * Delete all the objects in the proper order.                        
     */                        
    for (i = 0; i < targetObjects->numrefs; i++)                        
    {                        
        ObjectAddress *thisobj = targetObjects->refs + i;                    
                            
        deleteOneObject(thisobj, depRel, flags);                    
    }                        
                            
    /* And clean up */                        
    free_object_addresses(targetObjects);                        
                            
    heap_close(depRel, RowExclusiveLock);                        
}                            
复制代码





目录
相关文章
|
5月前
视频删除
视频删除
60 0
评论删除出现bug
评论删除出现bug
62 0
|
OLTP 数据库
数据的删除与修改
数据的删除与修改
186 0
Notepad++输入模式之修改模和插入模式的切换
Notepad++中输入内容提供了两种模式: 一种是插入,另一种是改写。分别对应光标的两种状态:横线(_)、竖线(|)
3988 0
|
JSON Kubernetes Java
kubenetes: patch更新和替换、删除资源内容
kubenetes: patch更新和替换、删除资源内容
1363 0
kubenetes: patch更新和替换、删除资源内容
|
C# C++
VS2015 更改C++模式
亲爱的小伙伴,有没有发现你们的VS2015装完以后和老江湖们用的不一样了,人家的界面打开是这样的
273 0
VS2015 更改C++模式
|
关系型数据库 Shell PostgreSQL