91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

PostgreSQL DBA(130) - Extension(pgsql-gzip)

發布時間:2020-08-07 22:49:18 來源:ITPUB博客 閱讀:212 作者:husthxd 欄目:關系型數據庫

本文簡單介紹了PostgreSQL的插件:pgsql-gzip。該插件可用于對列進行加密和解密。

安裝
clone代碼,編譯安裝

[pg12@localhost contrib]$ git clone https://github.com/pramsey/pgsql-gzip.git
Cloning into 'pgsql-gzip'...
remote: Enumerating objects: 114, done.
remote: Counting objects: 100% (114/114), done.
remote: Compressing objects: 100% (71/71), done.
remote: Total 114 (delta 63), reused 81 (delta 35), pack-reused 0
Receiving objects: 100% (114/114), 18.56 KiB | 0 bytes/s, done.
Resolving deltas: 100% (63/63), done.
[pg12@localhost contrib]$ cd pgsql-gzip/
[pg12@localhost pgsql-gzip]$ make
gcc -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O0 -DOPTIMIZER_DEBUG -g3 -gdwarf-2 -fPIC -I. -I./ -I/appdb/pg12/pg12.0/include/postgresql/server -I/appdb/pg12/pg12.0/include/postgresql/internal  -D_GNU_SOURCE -I/usr/include/libxml2   -c -o pg_gzip.o pg_gzip.c -MMD -MP -MF .deps/pg_gzip.Po
gcc -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O0 -DOPTIMIZER_DEBUG -g3 -gdwarf-2 -fPIC -shared -o gzip.so pg_gzip.o -L/appdb/pg12/pg12.0/lib    -Wl,--as-needed -Wl,-rpath,'/appdb/pg12/pg12.0/lib',--enable-new-dtags  -lz   
[pg12@localhost pgsql-gzip]$ make install
/bin/mkdir -p '/appdb/pg12/pg12.0/lib/postgresql'
/bin/mkdir -p '/appdb/pg12/pg12.0/share/postgresql/extension'
/bin/mkdir -p '/appdb/pg12/pg12.0/share/postgresql/extension'
/bin/install -c -m 755  gzip.so '/appdb/pg12/pg12.0/lib/postgresql/gzip.so'
/bin/install -c -m 644 .//gzip.control '/appdb/pg12/pg12.0/share/postgresql/extension/'
/bin/install -c -m 644 .//gzip--1.0.sql  '/appdb/pg12/pg12.0/share/postgresql/extension/'
[pg12@localhost pgsql-gzip]$ make installcheck
/appdb/pg12/pg12.0/lib/postgresql/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=./ --bindir='/appdb/pg12/pg12.0/bin'    --dbname=contrib_regression gzip
(using postmaster on Unix socket, default port)
============== dropping database "contrib_regression" ==============
DROP DATABASE
============== creating database "contrib_regression" ==============
CREATE DATABASE
ALTER DATABASE
============== running regression test queries        ==============
test gzip                         ... ok          253 ms
=====================
 All 1 tests passed. 
=====================
[pg12@localhost pgsql-gzip]$

體驗
創建擴展

[local]:5432 pg12@testdb=# create extension gzip
pg12@testdb-# ;
CREATE EXTENSION
[local]:5432 pg12@testdb=#

主要的函數包括gzip和gunzip

[local]:5432 pg12@testdb=# \df gzip
                                               List of functions
 Schema | Name | Result data type |                         Argument data types                         | Type 
--------+------+------------------+---------------------------------------------------------------------+------
 public | gzip | bytea            | uncompressed bytea, compression_level integer DEFAULT '-1'::integer | func
 public | gzip | bytea            | uncompressed text, compression_level integer DEFAULT '-1'::integer  | func
(2 rows)
[local]:5432 pg12@testdb=# \df gunzip
                        List of functions
 Schema |  Name  | Result data type | Argument data types | Type 
--------+--------+------------------+---------------------+------
 public | gunzip | bytea            | compressed bytea    | func
(1 row)

壓縮/解壓

[local]:5432 pg12@testdb=# select gzip('測試數據123測試');
                                       gzip                                       
----------------------------------------------------------------------------------
 \x1f8b08000000000000037bb6b5fbc5faa9cfa66e78d6bbced0c8f819980b00299ee5af15000000
(1 row)
[local]:5432 pg12@testdb=# select gunzip('\x1f8b08000000000000037bb6b5fbc5faa9cfa66e78d6bbced0c8f819980b00299ee5af15000000'::bytea);
                    gunzip                    
----------------------------------------------
 \xe6b58be8af95e695b0e68dae313233e6b58be8af95
(1 row)
[local]:5432 pg12@testdb=# select gunzip(gzip('測試數據123測試'));
                    gunzip                    
----------------------------------------------
 \xe6b58be8af95e695b0e68dae313233e6b58be8af95
(1 row)
[local]:5432 pg12@testdb=# 
[local]:5432 pg12@testdb=# select '測試數據123測試'::bytea;
                    bytea                     
----------------------------------------------
 \xe6b58be8af95e695b0e68dae313233e6b58be8af95
(1 row)
[local]:5432 pg12@testdb=#

通過pgsql-gzip可實現非透明的壓縮和解壓。

參考資料
pgsql-gzip
GZip in PostgreSQL

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

普洱| 白水县| 中山市| 新津县| 新龙县| 慈利县| 抚州市| 浦东新区| 苏尼特右旗| 班戈县| 蕉岭县| 雷波县| 金门县| 肇源县| 大庆市| 那坡县| 沙湾县| 龙游县| 益阳市| 苗栗市| 南和县| 阜新市| 新乡县| 金堂县| 宝兴县| 开平市| 聂拉木县| 乌兰县| 左云县| 饶河县| 乌兰察布市| 永安市| 贵溪市| 乐东| 丘北县| 那坡县| 马鞍山市| 富锦市| 二手房| 灌阳县| 台东市|