Greenplum 与 PostgreSQL 修改元数据(catalog)的方法 allow_system_table_mods
时间:2019-11-27
本文章向大家介绍Greenplum 与 PostgreSQL 修改元数据(catalog)的方法 allow_system_table_mods,主要包括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
原文地址:https://www.cnblogs.com/xibuhaohao/p/11943035.html
- Mybatis XML 映射配置文件 -- 熟悉配置
- Mybatis 入门 -- 最简单的引入和使用
- sqlite - java 初学
- Tomcat创建HTTPS访问,java访问https
- AWS CLI使用s3
- Linux中mongodb安装和导出为json
- git取消跟踪文件
- spring-boot - demo
- Mybatis - 动态sql
- git版本回退, github版本回退
- Mybatis高级查询之关联查询
- Mybatis-update - 数据库死锁 - 获取数据库连接池等待
- 使用Apache Server 的ab进行web请求压力测试
- Spring-AOP实践 - 统计访问时间
- MySQL 教程
- MySQL 安装
- MySQL 管理与配置
- MySQL PHP 语法
- MySQL 连接
- MySQL 创建数据库
- MySQL 删除数据库
- MySQL 选择数据库
- MySQL 数据类型
- MySQL 创建数据表
- MySQL 删除数据表
- MySQL 插入数据
- MySQL 查询数据
- MySQL where 子句
- MySQL UPDATE 查询
- MySQL DELETE 语句
- MySQL LIKE 子句
- mysql order by
- Mysql Join的使用
- MySQL NULL 值处理
- MySQL 正则表达式
- MySQL 事务
- MySQL ALTER命令
- MySQL 索引
- MySQL 临时表
- MySQL 复制表
- 查看MySQL 元数据
- MySQL 序列 AUTO_INCREMENT
- MySQL 处理重复数据
- MySQL 及 SQL 注入
- MySQL 导出数据
- MySQL 导入数据
- MYSQL 函数大全
- MySQL Group By 实例讲解
- MySQL Max()函数实例讲解
- mysql count函数实例
- MYSQL UNION和UNION ALL实例
- MySQL IN 用法
- MySQL between and 实例讲解
- 使用文件读写操作统计哈利波特英文版中的字母,单词,并按要求输出
- 2019.10.4 上课测试
- 贪心算法----最小差距
- Codeforces #594 div1 B/div2 D2 – The World Is Just a Programming Task
- Assert断言的常用方法
- java基础(五)之static关键词的作用
- [Noip2018]填数游戏
- C#调用WebApi(转)
- Writeup:第五届上海市大学生网络安全大赛-Web
- tensorflow 13:多gpu 并行训练
- [题解]luogu_P3939_数颜色(vector二分
- STM32位带操作
- 1003: [编程入门]密码破译C++
- WebSocket网络通信协议
- Spring中的事务控制