Greenplum 与 PostgreSQL 修改元数据(catalog)的方法 allow_system_table_mods
背景
PostgreSQL大量的信息保存在元数据中,所有的元数据都是内部维护的,例如建表、建索引、删表等操作,自动维护元数据。
在某些迫不得已的情况下才可能需要直接对元数据进行修改。
默认情况下,用户是允许修改元数据的。
postgres=# \set VERBOSITY verbose
postgres=# delete from pg_class where relname='test';
ERROR: 42809: permission denied: "pg_class" is a system catalog
LOCATION: setTargetTable, parse_clause.c:802
Greenplum 打开修改元数据开关的方法
postgres=# set allow_system_table_mods='DML';
SET
postgres=# begin;
BEGIN
postgres=# delete from pg_class where relname='test';
DELETE 1
postgres=# rollback;
ROLLBACK
PostgreSQL 打开修改元数据开关的方法
1、与Greenplum不同
postgres=# set allow_system_table_mods='DML';
ERROR: parameter "allow_system_table_mods" cannot be changed without restarting the server
2、需要重启生效,配置为on, off。
postgres=# alter system set allow_system_table_mods=on;
ALTER SYSTEM
postgres=# \q
digoal@ -> pg_ctl stop -m fast
waiting for server to shut down....................... done
server stopped
digoal@ -> pg_ctl start
waiting for server to start....2018-06-24 10:27:04.987 CST [4239] LOG: 00000: listening on IPv4 address "0.0.0.0", port 4000
2018-06-24 10:27:04.987 CST [4239] LOCATION: StreamServerPort, pqcomm.c:593
2018-06-24 10:27:04.990 CST [4239] LOG: 00000: listening on Unix socket "/tmp/.s.PGSQL.4000"
2018-06-24 10:27:04.990 CST [4239] LOCATION: StreamServerPort, pqcomm.c:587
2018-06-24 10:27:04.991 CST [4239] LOG: 00000: listening on Unix socket "./.s.PGSQL.4000"
2018-06-24 10:27:04.991 CST [4239] LOCATION: StreamServerPort, pqcomm.c:587
..2018-06-24 10:27:06.980 CST [4239] LOG: 00000: redirecting log output to logging collector process
2018-06-24 10:27:06.980 CST [4239] HINT: Future log output will appear in directory "log".
2018-06-24 10:27:06.980 CST [4239] LOCATION: SysLogger_Start, syslogger.c:635
done
server started
digoal@ -> psql
psql (11beta1)
Type "help" for help.
postgres=# show allow_system_table_mods;
allow_system_table_mods
-------------------------
on
(1 row)
postgres=# begin;
BEGIN
postgres=# delete from pg_class where relname='test';
DELETE 1
postgres=# rollback;
ROLLBACK
postgres=# \d test
Table "public.test"
Column | Type | Collation | Nullable | Default
--------+--------+-----------+----------+-------------------------------------
id | bigint | | |
c1 | text | | | md5((random())::text)
c2 | text | | | md5((random())::text)
c3 | text | | | md5((random())::text)
c4 | text | | | md5((random())::text)
c5 | text | | | md5((random())::text)
参考
https://www.postgresql.org/docs/10/static/runtime-config-developer.html
转载自:https://yq.aliyun.com/articles/647438
Greenplum 与 PostgreSQL 修改元数据(catalog)的方法 allow_system_table_mods的更多相关文章
- [转帖]Greenplum: 基于PostgreSQL的分布式数据库内核揭秘(下篇)
Greenplum: 基于PostgreSQL的分布式数据库内核揭秘(下篇) http://www.postgres.cn/v2/news/viewone/1/454 原作者:姚延栋 创作时间:201 ...
- linux修改主机名的方法
linux修改主机名的方法 用hostname命令可以临时修改机器名,但机器重新启动之后就会恢复原来的值. #hostname //查看机器名#hostname -i //查看本机器名对应的ip ...
- 修改 SVN 账户密码的方法
记是记不住 的,即便是每天都在用的东西,也有貌似熟悉其实很陌生的时候,或者说根本就是不熟悉.于是需要拿出来经常翻翻,比如我们的SVN账户配置,很简单的一个 case,你可能是svn使用高手,但不一定记 ...
- MyEclipse默认编码为GBK,修改为UTF8的方法
MyEclipse 默认编码居然是GBK,js文件默认编码是ISO-....怎么可以这样呢? 都修改成UTF8的方法: 1.windows->Preferences...打开"首选项& ...
- Method Swizzle黑魔法,修改 ios 系统类库方法 SEL IMP
Method Swizzle黑魔法,修改 ios 系统类库方法 版权声明:本文为博主原创文章,未经博主允许不得转载. 一般来说,系统提供的方法已经足够开发了,但是有的时候有些需求用普通方法不好做. ...
- Centos7.3下mysql5.7.18安装并修改初始密码的方法
Centos7.3下mysql5.7.18安装并修改初始密码的方法 原文链接:http://www.jb51.net/article/116032.htm 作者:Javen205 字体:[增加 减小] ...
- SQLServer2008修改sa密码的方法与SQL server 2008数据库的备份与还原
sa密码的修改转载自:http://blog.csdn.net/templar1000/article/details/20211191 SQL server 2008数据库的备份与还原转自 :htt ...
- Linux网络相关概念和修改IP地址的方法
2.1.1 网卡的命名规则 CENTOS6的网卡命名方式:它会根据情况有所改变而非唯一且固定,在CENTOS6之前,网络接口使用连续号码命名: eth0. eth1等,当增加或删除网卡时,名称可能会 ...
- 修改MAC地址的方法 破解MAC地址绑定(抄)
修改MAC地址的方法 破解MAC地址绑定 网卡的MAC地址是固化在网上EPROM中的物理地址,是一块网卡的“身份证”,通常为48位.在平常的应用中,有很多方面与MAC地址相关,如有些软件是和MAC ...
随机推荐
- Source Insight4.0软件破解版
安装source insightt4.0 1.将下载好的sourceinsight4.exe替换安装在program file(x86)目录下的sourceinsight4.exe; 2.启动sour ...
- maven系列:archetype项目模板_create-from-project
主要介绍create-from-project插件在命令行下的使用. [第一步:生成模板项目] 新建一个maven项目,比如叫 :groupId=com.abc.demo,artifactId=com ...
- Java 中 Hashtable与HashMap的区别
Map Map是一个以键值对存储的接口.Map下有两个具体的实现,分别是HashMap和HashTable. 区别: 1.HashMap是线程非安全的,HashTable是线程安全的,所以HashMa ...
- Java之路---Day09(继承)
2019-10-23-22:58:23 目录 1.继承 2.区分成员变量重名的方法 3.区分成员方法重名的方法 4.继承中重写与重载的区别 5.继承中覆盖重写的注意事项 6.继承中覆盖重写的设计原则 ...
- python基础知识(七)---数据类型补充、"雷区"、编码
数据类型补充."雷区".编码 1.数据类型补充 str: #字符串数据类型补充 s1=str(123) #常用于类型转换 print(s1) #capitalize()首字母大写 ...
- php长连接应用
php长连接和短连接 2012-12-05 17:25 3529人阅读 评论(0) 收藏 举报 分类: 我的收藏(8) 什么是长连接,如果你没听说过,可以往下看! 长连接到底有什么用?我想你应该见 ...
- CSS3 小黄人案例
使用 CSS3 和 HTML5 制作一个小黄人. 结构代码: <div class="wrap"> <!-- 头发 --> <div class=&q ...
- Code Clean读书笔记
代码整洁之道读书笔记 by fangpc 序言部分 "神在细节之中" - 建筑师路德维希 5S哲学(精益) 整理(Seiri):搞清楚事物之所在--通过恰当地命名之类的手段--至关 ...
- sql server快捷键添加
工具--选项--键盘 sp_table_column_info p_helpindex sp_sql
- MySQL MGR--数据同步原理
MGR复制架构 在MySQL 5.7.17版本正式推出组复制(MySQL Group Repliation MGR),用来解决异步复制和半同步复制可能产生数据不一致的问题,组复制依靠分布式一致性协议( ...