Vertica的这些事(四)——-vertica加密数据

通过创建 Secure Access Policies可以对vertica中的某一列数据进行加密:

1
2
3
4
CREATE ACCESS POLICY ON [schema][tablename]
FOR COLUMN columnname
expression
[ENABLE/DISABLE];

例如:

1
2
3
4
5
6
7
8
CREATE ACCESS POLICY ON customers_table
FOR COLUMN SSN
CASE
WHEN ENABLED_ROLE('manager') THEN SSN
WHEN ENABLED_ROLE('operator') THEN SUBSTR(SSN, 8, 4)
ELSE NULL
END
ENABLE;
1
2
3
4
5
6
7
8
9
10
11
12
ALTER ACCESS POLICY
ALTER ACCESS POLICY ON tablename

.. .FOR COLUMN columnname
... expression
... [ENABLE | DISABLE];
... | FOR COLUMN columname
... COPY TO tablename;

DROP ACCESS POLICY
DROP ACCESS POLICY ON tablename
FOR COLUMN columnname;

如果表中存在策略的话,那么drop table 时会报错:
这里写图片描述