omni_csv

CSV toolkit

Overview

PackageVersionCategoryLicenseLanguage
omni_csv0.1.1FEATApache-2.0C
IDExtensionBinLibLoadCreateTrustRelocSchema
2946omni_csvNoYesNoYesNoNoomni_csv

Version

TypeRepoVersionPG VerPackageDeps
EXTPIGSTY0.1.11817161514omni_csv-
RPMPIGSTY0.1.11817161514omnigres_$v-
DEBPIGSTY0.1.11817161514postgresql-$v-omnigres-

Build

You can build the RPM / DEB packages for omni_csv using pig build:

pig build pkg omni_csv         # build RPM / DEB packages

Install

You can install omni_csv 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 omni_csv;          # Install for current active PG version
pig ext install -y omni_csv -v 18  # PG 18
pig ext install -y omni_csv -v 17  # PG 17
pig ext install -y omni_csv -v 16  # PG 16
pig ext install -y omni_csv -v 15  # PG 15
pig ext install -y omni_csv -v 14  # PG 14
dnf install -y omnigres_18       # PG 18
dnf install -y omnigres_17       # PG 17
dnf install -y omnigres_16       # PG 16
dnf install -y omnigres_15       # PG 15
dnf install -y omnigres_14       # PG 14
apt install -y postgresql-18-omnigres   # PG 18
apt install -y postgresql-17-omnigres   # PG 17
apt install -y postgresql-16-omnigres   # PG 16
apt install -y postgresql-15-omnigres   # PG 15
apt install -y postgresql-14-omnigres   # PG 14

Create Extension:

CREATE EXTENSION omni_csv;

Usage

omni_csv: CSV toolkit

The omni_csv extension provides CSV parsing, inspection, and generation functions.

Inspect CSV Structure

SELECT * FROM omni_csv.csv_info(E'name,age,city\nJohn,25,NYC\nJane,30,LA');
-- Returns: name, age, city (one row per column)

Parse CSV into Records

SELECT * FROM omni_csv.parse(E'name,age,city\nJohn,25,NYC\nJane,30,LA')
    AS t(name text, age text, city text);

Column structure must be specified using the AS t(...) clause and should match the CSV structure.

Generate CSV from Query Results

SELECT omni_csv.csv_agg(t)
FROM (SELECT name, age, city FROM employees ORDER BY name) t;

Returns CSV text with headers and properly escaped values. Returns empty string on empty result sets.

Limitations

  • Large CSV strings are processed entirely in memory (no streaming)
  • Column types must be declared in the AS t(...) clause
  • Consider materializing parsed data for repeated access

Last Modified 2026-03-12: add pg extension catalog (95749bf)