摘要: 行级安全策略可以配置表中的那些数据可以被那些用户进行某种操作,比如rsl表中的name=aa的数据可以让a1看到 using 针对已经存在的记录的校验. 可实施在select, update, delete, ALL上 whth check 针对将要新增的记录的校验, 可实施在insert, upd 阅读全文
posted @ 2022-06-22 10:16 南大仙 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 添加列 新加的字段为默认值,如果没有默认值,则会自动默认为空 mydb=# select * from products; product_no | name | price + + 1 | aaa | 2.11 1 | aa | (2 rows) mydb=# ALTER TABLE produc 阅读全文
posted @ 2022-06-21 11:44 南大仙 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 约束 mydb=# CREATE TABLE products (product_no integer,name text,price numeric CHECK (price > 0)); //添加约束 price > 0 CREATE TABLE mydb=# mydb=# mydb=# ins 阅读全文
posted @ 2022-06-21 11:21 南大仙 阅读(161) 评论(0) 推荐(0) 编辑
摘要: postgresql隐藏字段 在 PostgreSQL 中,当我们创建一个数据表时,数据库会隐式增加几个字段。这些字段由数据库系自动维护,用户一般不会感知 tableoid ctid xmin xmax cmin cmax oid tableoid 包含这一行的表的OID。该列是特别为从继承层次(见 阅读全文
posted @ 2022-06-20 17:06 南大仙 阅读(1161) 评论(0) 推荐(0) 编辑
摘要: 我们在分组后,可以查出分组中复合条件的count,以及分组的count。 postgres=# create table test(id int, c1 int); CREATE TABLE postgres=# insert into test select generate_series(1,1 阅读全文
posted @ 2022-06-20 16:23 南大仙 阅读(886) 评论(0) 推荐(0) 编辑
摘要: standard_conforming_strings=on,\失去了转义的意思,即‘’中是什么就是什么,但是standard_conforming_strings=off时,\会保留转义的含义所以select '\'即为'' 在Unicode转义语法中,反斜杠后的任何其他字符均按字面意义使用。因此 阅读全文
posted @ 2022-06-20 10:30 南大仙 阅读(453) 评论(0) 推荐(0) 编辑
摘要: PostgreSQL Unicode标识符 mydb=# select U&"\0044\0061\0054\+000061" UESCAPE '\'; ERROR: column "DaTa" does not exist LINE 1: select U&"\0044\0061\0054\+00 阅读全文
posted @ 2022-06-20 10:11 南大仙 阅读(22) 评论(0) 推荐(0) 编辑
摘要: postgresql内核日志格式为postgresql-2022-06-07_081953.log log_filename = 'PostgreSQL-%Y-%m-%d.log' PostgreSQL-%Y-%m-%d.log中的%Y%m%d格式如下解释 Linux日期格式 date +%Y%m% 阅读全文
posted @ 2022-06-09 10:19 南大仙 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 修改参数 1.全局修改方法 alter system set 参数名='参数值' 2.非全局配置的参数修改方法 数据库级别的配置 alter database name set 参数名 to|= 参数值 //修改 alter database name reset configuration //重 阅读全文
posted @ 2022-05-16 13:44 南大仙 阅读(1074) 评论(0) 推荐(0) 编辑
摘要: 数组类型 create table test_arr(id int,arr_people test[],arr_classid int[]); 增 insert into test_arr values(1,array['a','b','c','d','e'],array[1,2,3,4,5]); 阅读全文
posted @ 2022-05-14 12:53 南大仙 阅读(265) 评论(0) 推荐(0) 编辑