通过创建 Secure Access Policies可以对vertica中的某一列数据进行加密:
CREATE ACCESS POLICY ON [schema][tablename]
FOR COLUMN columnname
expression
[ENABLE/DISABLE];
例如:
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;
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 时会报错: