本文简单介绍了PostgreSQL的插件:pgsql-gzip。该插件可用于对列进行加密和解密。
<>强安装强>
克隆代码,编译安装
<前>
<代码> (pg12@localhost contrib)美元git克隆https://github.com/pramsey/pgsql-gzip.git
克隆到“pgsql-gzip”……
远程:列举对象:114年完成。
远程:计数对象:100%(114/114),完成。
远程:压缩对象:100%(71/71),完成。
远程:总数114(三角洲63),再利用81(δ35),pack-reused 0
接收对象:100%(114/114),18.56简约| 0字节/秒,完成。
解决增量:100%(63/63),完成。
(pg12@localhost contrib) $ cd pgsql-gzip/[pg12@localhost pgsql-gzip]美元
gcc化- wall gnu99 -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=标准- g o0 -DOPTIMIZER_DEBUG g3 -gdwarf-2 - fpic - i。-我。/我/appdb/pg12 pg12.0/include/postgresql/服务器- i/appdb/pg12/pg12.0/include/postgresql/内部-D_GNU_SOURCE - i/usr/include/libxml2 - c - o pg_gzip。o pg_gzip。c多党议员mf .deps/pg_gzip.Po
gcc化- wall gnu99 -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=标准- g o0 -DOPTIMIZER_DEBUG g3 -gdwarf-2 - fpic - shared - o gzip。所以pg_gzip。o - l/appdb/pg12/pg12.0/自由- wl -需- wl, rpath, '/appdb/pg12 pg12.0/lib”,——enable-new-dtags楼主
[pg12@localhost pgsql-gzip]美元制作安装/bin/mkdir - p '/appdb/pg12/pg12.0/lib/postgresql的/bin/mkdir - p '/appdb/pg12 pg12.0/分享/postgresql/扩展的/bin/mkdir - p '/appdb/pg12 pg12.0/分享/postgresql/扩展的/bin/install - c - m 755 gzip。所以'/appdb/pg12/pg12.0/lib/postgresql/gzip.so '/bin/install - c - m 644。//gzip。控制”/appdb/pg12/pg12.0/分享/postgresql/扩展/'/bin/install - c - m 644。//gzip——1.0。sql '/appdb/pg12 pg12.0/分享/postgresql/扩展/'
[pg12@localhost pgsql-gzip]使installcheck美元/appdb/pg12/pg12.0/lib/postgresql/pgxs/src/makefile/. ./. ./src/测试/回归/pg_regress——inputdir=之类。/猙indir='/appdb/pg12/pg12.0/bin”——dbname=contrib_regression gzip
(在Unix socket使用邮政局长,默认端口)==============删除数据库“contrib_regression”==============删除数据库==============创建数据库“contrib_regression”==============创建数据库
修改数据库==============运行回归测试查询==============测试gzip……好253毫秒=====================所有1测试通过。=====================[pg12@localhost pgsql-gzip]美元
代码>
<>强体验强>
创建扩展
<前>
<代码>(本地):5432 pg12@testdb gzip=#创建扩展
pg12@testdb - #;
创建扩展
(本地):5432 pg12@testdb=#
代码>
主要的函数包括gzip和gunzip
<前> <代码>(本地):5432 pg12@testdb=# \ df gzip 功能列表 模式| | | |结果数据类型参数数据类型名称类型 - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - 公共| gzip | bytea |未压缩bytea, compression_level整数默认' 1 '::整数| func 公共| gzip | bytea |未压缩的文本,compression_level整数默认' 1 '::整数| func (2行) (本地):5432 pg12@testdb=# \ df gunzip 功能列表 模式| | | |结果数据类型参数数据类型名称类型 - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - 公共| gunzip | bytea压缩bytea | | func (1行) 代码>压缩/解压
<前> <代码>(本地):5432 pg12@testdb=#选择gzip(“测试数据123年测试”); gzip ---------------------------------------------------------------------------------- \ x1f8b08000000000000037bb6b5fbc5faa9cfa66e78d6bbced0c8f819980b00299ee5af15000000 (1行) (本地):5432 pg12@testdb=#选择gunzip (‘\ x1f8b08000000000000037bb6b5fbc5faa9cfa66e78d6bbced0c8f819980b00299ee5af15000000:: bytea); gunzip - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ xe6b58be8af95e695b0e68dae313233e6b58be8af95 (1行) (本地):5432 pg12@testdb=#选择gunzip (gzip(“测试数据123年测试')); gunzip - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ xe6b58be8af95e695b0e68dae313233e6b58be8af95 (1行) (本地):5432 pg12@testdb=# (本地):5432 pg12@testdb=#选择“测试数据123年测试”::bytea; bytea - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ xe6b58be8af95e695b0e68dae313233e6b58be8af95 (1行) (本地):5432 pg12@testdb=#