博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PostreSQL 的模式创建的代码位于何处
阅读量:6886 次
发布时间:2019-06-27

本文共 3002 字,大约阅读时间需要 10 分钟。

主要代码在 src/backend/catalog/pg_namespace.c

/* ----------------                         * NamespaceCreate                         *                         * Create a namespace (schema) with the given name and owner OID.                         *                         * If isTemp is true, this schema is a per-backend schema for holding                         * temporary tables.  Currently, the only effect of that is to prevent it                         * from being linked as a member of any active extension.  (If someone                         * does CREATE TEMP TABLE in an extension script, we don't want the temp                         * schema to become part of the extension.)                         * ---------------                         */                        Oid                        NamespaceCreate(const char *nspName, Oid ownerId, bool isTemp)                        {                            ……                        nspoid = simple_heap_insert(nspdesc, tup);                        Assert(OidIsValid(nspoid));                                                CatalogUpdateIndexes(nspdesc, tup);                                                heap_close(nspdesc, RowExclusiveLock);                                                /* Record dependencies */                        myself.classId = NamespaceRelationId;                        myself.objectId = nspoid;                        myself.objectSubId = 0;                                                /* dependency on owner */                        recordDependencyOnOwner(NamespaceRelationId, nspoid, ownerId);                                                /* dependency on extension ... but not for magic temp schemas */                        if (!isTemp)                            recordDependencyOnCurrentExtension(&myself, false);                                            /* Post creation hook for new schema */                        InvokeObjectAccessHook(OAT_POST_CREATE,                                       NamespaceRelationId, nspoid, 0, NULL);                                    return nspoid;                        ……                    }
NamespaceCreate 被 src/backend/commands/schemacmds.c 的 CreateSchemaCommand 调用
/*                             * CREATE SCHEMA                             */                            void                            CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString)                            {                                ……                            /* Create the schema's namespace */                            namespaceId = NamespaceCreate(schemaName, owner_uid, false);                                                        /* Advance cmd counter to make the namespace visible */                            CommandCounterIncrement();                            ……                        }

接下来,我特别想知道,得到的 oid ,被用到了什么地方,以何种方式存储。

本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/archive/2012/10/26/2740700.html,如需转载请自行联系原作者

你可能感兴趣的文章
C# String.Format的格式限定符与Format方法将多个对象格式化一个字符串原理
查看>>
zookeeper的监控
查看>>
JPA(六):映射关联关系------映射单向一对多的关联关系
查看>>
SPOJ1811 LCS - Longest Common Substring(后缀自动机)
查看>>
linux调试工具glibc的演示分析-core dump double free【转】
查看>>
Top 22 Free Responsive HTML5 Admin & Dashboard Templates 2018
查看>>
适合初学者的python实际例子
查看>>
我的第一个python web开发框架(25)——定制ORM(一)
查看>>
Android padding 和margin
查看>>
IOS UIView 01-View开始深入 绘制像素到屏幕上
查看>>
在Android中使用Protocol Buffers(中篇)
查看>>
Apache之Rewrite和RewriteRule规则梳理以及http强转https的配置总结
查看>>
八种架构设计模式及其优缺点概述
查看>>
Django的AbstractUser的几大步骤
查看>>
Caching in Presto
查看>>
SpringMVC拦截器详解
查看>>
Python3+pyshark捕获数据包并保存为文件
查看>>
Unable to launch the IIS Express Web server
查看>>
怎样使用EOS.JS的API
查看>>
Spring Boot项目配置RabbitMQ集群
查看>>