Skip to content

Releases: pgsty/pig

v0.1.0 repo, ext, sty and self-update

29 Dec 09:29

Choose a tag to compare

The pig CLI v0.1 is out, with the following new features:

Install Script

curl -fsSL https://repo.pigsty.io/pig | bash     # cloudflare, default 
curl -fsSL https://repo.pigsty.cc/pig | bash     # mainland china mirror

Extension Management

You can download the extension and its dependencies with import subcommand, activate different postgres major versions with link, and prepare building env with build subcommand

pig ext list    [query]      # list & search extension      
pig ext info    [ext...]     # get information of a specific extension
pig ext status  [-v]         # show installed extension and pg status
pig ext add     [ext...]     # install extension for current pg version
pig ext rm      [ext...]     # remove extension for current pg version
pig ext update  [ext...]     # update extension to the latest version
pig ext import  [ext...]     # download extension to local repo
pig ext link    [ext...]     # link postgres installation to path
pig ext build   [ext...]     # setup building env for extension

Repo Management

You can now create local repo and create a tarball (offline package) from it, copy it to somewhere (e.g. without internet access), and create a repo from that offline package:

pig repo list                    # available repo list             (info)
pig repo info   [repo|module...] # show repo info                  (info)
pig repo status                  # show current repo status        (info)
pig repo add    [repo|module...] # add repo and modules            (root)
pig repo rm     [repo|module...] # remove repo & modules           (root)
pig repo update                  # update repo pkg cache           (root)
pig repo create                  # create repo on current system   (root)
pig repo boot                    # boot repo from offline package  (root)
pig repo cache                   # cache repo as offline package   (root)

Pigsty Management

The pig can also be used as a CLI tool for Pigsty - the battery-include free PostgreSQL RDS

pig sty init     # install embed pigsty to ~/pigsty 
pig sty boot     # install ansible and other pre-deps 
pig sty conf     # auto-generate pigsty.yml config file
pig sty install  # run the install.yml playbook

Self-Updating

To update pig itself to the latest version, you can use the following command:

pig update

Info

Now pig info provide more details about your OS & PG environment:

$ pig info

# [Configuration] ================================
Pig Version      : 0.1.0
Pig Config       : /home/vagrant/.pig/config.yml
Log Level        : info
Log Path         : stderr

# [OS Environment] ===============================
OS Distro Code   : el9
OS Architecture  : amd64
OS Package Type  : rpm
OS Vendor ID     : rocky
OS Version       : 9
OS Version Full  : 9.3
OS Version Code  : el9

# [PG Environment] ===============================
Installed:
* PostgreSQL 17.2  74  Extensions

Active:
PG Version      :  PostgreSQL 17.2
Config Path     :  /usr/pgsql-17/bin/pg_config
Binary Path     :  /usr/pgsql-17/bin
Library Path    :  /usr/pgsql-17/lib
Extension Path  :  /usr/pgsql-17/share/extension

# [Pigsty Environment] ===========================
Inventory Path   : /home/vagrant/pigsty/pigsty.yml
Pigsty Home      : /home/vagrant/pigsty
Embedded Version : 3.2.0

# [Network Conditions] ===========================
pigsty.cc  ping ok: 141 ms
pigsty.io  ping ok: 930 ms
google.com request error
Internet Access   :  true
Pigsty Repo       :  pigsty.io
Inferred Region   :  china
Latest Pigsty Ver :  v3.2.0
46165beec97ab9ff1314f80af953bd59  pig-0.1.0-1.aarch64.rpm
1320a6f9bfbd79948515657d6becbf37  pig-0.1.0-1.x86_64.rpm
bd078a5dc0c41454fcbbe0d8693d5fa0  pig-v0.1.0.linux-amd64.tar.gz
8a15e52f96735b78afa7da42843f1504  pig-v0.1.0.linux-arm64.tar.gz
4d25597cff8425c7e52a2b411344aa4a  pig_0.1.0_amd64.deb
d5f0874601bc1bbd0dd40b5c9982ea9f  pig_0.1.0_arm64.deb

pig

Enjoy PostgreSQL!

What's Changed

New Contributors

Full Changelog: v0.0.1...v0.1.0

0.0.1 Genesis Release

23 Dec 05:32

Choose a tag to compare

pig


Get Started

Install the pig package first, you can also install via apt/yum command.

curl -fsSL https://repo.pigsty.io/pig | bash     # cloudflare, default 
curl -fsSL https://repo.pigsty.cc/pig | bash     # mainland china mirror

Then it's ready to use, assume you want to install the pg_duckdb extension:

$ pig repo add pigsty pgdg -u  # add pgdg & pigsty repo, update cache      
$ pig ext install pg17         # install PostgreSQL 17 kernels with PGDG native packages
$ pig ext install pg_duckdb    # install the pg_duckdb extension (for current pg17)

That's it! All set! you can check with the pig ext status sub command:

$ pig ext status               # show installed extension and pg status
                               # to print built-in contrib extension, use -c|--contrib flag
Installed PG Vers :  17 (active)
Active PostgreSQL :  PostgreSQL 17.2
PostgreSQL        :  PostgreSQL 17.2
Binary Path       :  /usr/pgsql-17/bin
Library Path      :  /usr/pgsql-17/lib
Extension Path    :  /usr/pgsql-17/share/extension
Extension Stat    :  1 Installed (PIGSTY 1, PGDG 0) + 67 CONTRIB = 68 Total

Name       Version  Cate  Flags   License  Repo    Package        Description
----       -------  ----  ------  -------  ------  ------------   ---------------------
pg_duckdb  0.2.0    OLAP  -dsl--  MIT      PIGSTY  pg_duckdb_17*  DuckDB Embedded in Postgres

(1 Rows) (Flags: b = HasBin, d = HasDDL, s = HasSolib, l = NeedLoad, t = Trusted, r = Relocatable, x = Unknown)

Check the advanced usage for details and list 340 available extensions.

asciicast


Installation

The pig util is a standalone go binary with no dependencies. you can just download the binary
or use the following commands to add the repo and install it via package manager (recommended).

For Ubuntu 22.04 / 24.04 & Debian 12 or any compatible platforms:

sudo tee /etc/apt/sources.list.d/pigsty.list > /dev/null <<EOF
deb [trusted=yes] https://repo.pigsty.io/apt/infra generic main 
EOF
sudo apt update; sudo apt install -y pig

For EL 8/9 and compatible platforms:

sudo tee /etc/yum.repos.d/pigsty.repo > /dev/null <<-'EOF'
[pigsty-infra]
name=Pigsty Infra for $basearch
baseurl=https://repo.pigsty.io/yum/infra/$basearch
enabled = 1
gpgcheck = 0
module_hotfixes=1
EOF
sudo yum makecache; sudo yum install -y pig

For mainland china user: consider replace the repo.pigsty.io with repo.pigsty.cc


Compatibility

pig runs on: RHEL 8/9, Ubuntu 22.04/24.04, and Debian 12, on both amd64/arm64 arch

Code Distribution x86_64 aarch64
el9 RHEL 9 / Rocky9 / Alma9 / ... PG 17 - 13 PG 17 - 13
el8 RHEL 8 / Rocky8 / Alma8 / ... PG 17 - 13 PG 17 - 13
u24 Ubuntu 24.04 (noble) PG 17 - 13 PG 17 - 13
u22 Ubuntu 22.04 (jammy) PG 17 - 13 PG 17 - 13
d12 Debian 12 (bookworm) PG 17 - 13 PG 17 - 13

Here are some bad cases and limitation for above distros:

  • citus is not available on aarch64 and ubuntu 24.04
  • pljava is missing on el8
  • jdbc_fdw is missing on el8.aarch64 and el9.aarch64
  • pllua is missing on el8.aarch64 for pg 13,14,15
  • topn is missing on el8.aarch64 and el9.aarch64 for pg13, and all deb.aarch64
  • pg_partman and timeseries is missing on u24 for pg13
  • wiltondb is missing on d12