bzip
Bzip compression and decompression
Repository
steve-chavez/pg_bzip
https://github.com/steve-chavez/pg_bzip
Source
pg_bzip-1.0.0.tar.gz
pg_bzip-1.0.0.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_bzip | 1.0.0 | UTIL | MIT | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4020 | bzip | No | Yes | No | Yes | No | No | - |
| Related | gzip zstd http pg_net pg_curl pgjq pgjwt pg_smtp_client |
|---|
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.0.0 | 1817161514 | pg_bzip | - |
| RPM | PIGSTY | 1.0.0 | 1817161514 | pg_bzip_$v | - |
| DEB | PIGSTY | 1.0.0 | 1817161514 | postgresql-$v-bzip | - |
Build
You can build the RPM / DEB packages for pg_bzip using pig build:
pig build pkg pg_bzip # build RPM / DEB packages
Install
You can install pg_bzip directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
pig repo add pgsql -u # Add repo and update cache
Install the extension using pig or apt/yum/dnf:
pig install pg_bzip; # Install for current active PG version
pig ext install -y pg_bzip -v 18 # PG 18
pig ext install -y pg_bzip -v 17 # PG 17
pig ext install -y pg_bzip -v 16 # PG 16
pig ext install -y pg_bzip -v 15 # PG 15
pig ext install -y pg_bzip -v 14 # PG 14
dnf install -y pg_bzip_18 # PG 18
dnf install -y pg_bzip_17 # PG 17
dnf install -y pg_bzip_16 # PG 16
dnf install -y pg_bzip_15 # PG 15
dnf install -y pg_bzip_14 # PG 14
apt install -y postgresql-18-bzip # PG 18
apt install -y postgresql-17-bzip # PG 17
apt install -y postgresql-16-bzip # PG 16
apt install -y postgresql-15-bzip # PG 15
apt install -y postgresql-14-bzip # PG 14
Create Extension:
CREATE EXTENSION bzip;
Usage
Functions
bzcat(data bytea) returns bytea– Decompress bzip2 data, similar to thebzcatcommand.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);
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.