bzip

pg_bzip : Bzip compression and decompression

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
4020
bzip
pg_bzip
1.0.0
UTIL
MIT
C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d--
No
Yes
No
Yes
no
no
Relationships
See Also
gzip
zstd
http
pg_net
pg_curl
pgjq
pgjwt
pg_smtp_client

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PIGSTY
1.0.0
18
17
16
15
14
pg_bzip-
RPM
PIGSTY
1.0.0
18
17
16
15
14
pg_bzip_$v-
DEB
PIGSTY
1.0.0
18
17
16
15
14
postgresql-$v-bzip-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
el8.aarch64
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
el9.x86_64
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
el9.aarch64
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
el10.x86_64
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
el10.aarch64
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
d12.x86_64
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
d12.aarch64
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
d13.x86_64
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
d13.aarch64
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
u22.x86_64
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
u22.aarch64
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
u24.x86_64
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
u24.aarch64
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0
PIGSTY 1.0.0

Source

pig build pkg pg_bzip;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_bzip;		# install via package name, for the active PG version
pig install bzip;		# install by extension name, for the current active PG version

pig install bzip -v 18;   # install for PG 18
pig install bzip -v 17;   # install for PG 17
pig install bzip -v 16;   # install for PG 16
pig install bzip -v 15;   # install for PG 15
pig install bzip -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION bzip;

Usage

bzip: Bzip compression and decompression

Functions

  • bzcat(data bytea) returns bytea – Decompress bzip2 data, similar to the bzcat command.
  • bzip2(data bytea, compression_level int default 9) returns bytea – Compress data using bzip2.

Examples

Decompress a bzip2-compressed file:

SELECT convert_from(bzcat(pg_read_binary_file('/path/to/data.csv.bz2')), 'utf8') AS contents;

Compress data with bzip2:

SELECT bzip2(repeat('my text to be compressed', 1000)::bytea) AS compressed;

Compress with a custom compression level (1-9):

SELECT bzip2('some data'::bytea, 5);
Last updated on