bytea_unzip
bytea_unzip · Read ZIP archives and ODS data from bytea
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 102413 | bytea_unzip | bytea_unzip | 1.0 | FUNC | PostgreSQL | C |
PostgreSQL · 16, 17, 18, 19
Usage
Sources:
bytea_unzip reads ZIP members from a bytea value and decomposes an OpenDocument spreadsheet table into rows of text arrays. SQL version 1.0 uses libzip and libxml2. Upstream documents PostgreSQL 16 or later and Linux/POSIX environments; the functions operate on supplied binary values.
Core Workflow
Install as a superuser. The control file permits relocation and does not require preload.
Populate the table with actual archive bytes through your application. bytea_is_zip() checks whether libzip recognizes an archive, not whether it contains useful files. bytea_unzip() returns the named member as bytea, returns NULL when that member is absent, and reports an error for invalid ZIP input. The listing returns file names, uncompressed and compressed sizes, and modification timestamps.
OpenDocument Tables
The input to decompose_ods_table_node() is one XML table node, and the result is a set of text arrays. bytea_unzip_version() and bytea_unzip_libzip_version() expose extension and library version numbers. NULL arguments produce NULL through strict functions.
Boundaries
The SQL surface contains functions, not a foreign-data wrapper. The README’s HTTP download example uses the separate http extension; that is optional and is not a dependency of these functions. Its unrelated spatial-result wording does not describe the verified installation SQL. Keep libzip and libxml2 available to the server and manage archive inputs within the application’s resource limits.