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 ...
随机推荐
- Haystack搜索框架
1.什么是Haystack Haystack是django的开源全文搜索框架(全文检索不同于特定字段的模糊查询,使用全文检索的效率更高 ),该框架支持Solr,Elasticsearch,Whoosh ...
- Mac Mini(late 2014) 添加NVMe固态组Fusion Drive
我买的是Mac Mini(late 2014)中配,内置5400转1T机械硬盘,该配置即使到了2019年安装macOS Mojave系统依旧是够用的,但硬盘严重拖累了运行的速度.之前考虑到更换内置sa ...
- 依赖注入 DI 控制反转 IOC 概念 案例 MD
Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...
- C#Dictionary不能添加重复键的解决方法
重载了一个方法: public class RepeatDictionaryComparer : IEqualityComparer<string> { public bool Equal ...
- node-red inject节点 debug节点 switch节点
inject节点: https://blog.csdn.net/geek_monkey/article/details/80737818 debug节点: https://blog.csdn.net/ ...
- java之spring之helloword
这篇文章主要讲 spring的基础的使用案例 项目整体目录结构: 1.新建一个java项目:spring_helloworld 2.在项目下创建一个lib文件夹,并把一些必须的jar包复制过去 新建l ...
- (转载) @ConfigurationProperties 注解使用姿势,这一篇就够了
SpringBoot中的@ConfigurationProperties 传送门: http://www.hellojava.com/a/82613.html
- 令人兴奋的TOP Server OPC Server v6.5 五大功能(下)
接上文. 2.MQTT客户端驱动程序自动标记生成(ATG) 使用过TOP Server OPC Server的大家可能还记得,在TOP Server OPC Server V6.4版本中,我们为MQT ...
- OC中并发编程的相关API和面临的挑战
OC中并发编程的相关API和面临的挑战(1) 小引 http://www.objc.io/站点主要以杂志的形式,深入挖掘在OC中的最佳编程实践和高级技术,每个月探讨一个主题,每个主题都会有几篇相关的文 ...
- 一道经典面试题,atoi函数的实现
参考资料 (1)atoi函数的实现 (2)<剑指offer> 题目分析 本题需要注意的有几个方面: (1)检查输入参数,指针是否为NULL: (2)去除字符串前面的空格 (3)处理正负符号 ...