Skip to content
pg_liquid

pg_liquid

pg_liquid : Liquid-inspired Datalog graph query extension for PostgreSQL

Overview

ID Extension Package Version Category License Language
2610
pg_liquid
pg_liquid
0.1.7
FEAT
MIT
C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--s-d--
No
Yes
No
Yes
no
no
Relationships
Schemas liquid
See Also
age
jsquery
pg_jsonschema
pg_search

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT
PIGSTY
0.1.7
18
17
16
15
14
pg_liquid -
RPM
PIGSTY
0.1.7
18
17
16
15
14
pg_liquid_$v -
DEB
PIGSTY
0.1.7
18
17
16
15
14
postgresql-$v-pg-liquid -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
el8.aarch64
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
el9.x86_64
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
el9.aarch64
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
el10.x86_64
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
el10.aarch64
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
d12.x86_64
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
d12.aarch64
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
d13.x86_64
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
d13.aarch64
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
u22.x86_64
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
u22.aarch64
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
u24.x86_64
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
u24.aarch64
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
u26.x86_64
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
u26.aarch64
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
PIGSTY 0.1.7
Package Version OS ORG SIZE File URL
pg_liquid_18 0.1.7 el8.x86_64 pigsty 64.7 KiB pg_liquid_18-0.1.7-1PIGSTY.el8.x86_64.rpm
pg_liquid_18 0.1.7 el8.aarch64 pigsty 62.0 KiB pg_liquid_18-0.1.7-1PIGSTY.el8.aarch64.rpm
pg_liquid_18 0.1.7 el9.x86_64 pigsty 62.7 KiB pg_liquid_18-0.1.7-1PIGSTY.el9.x86_64.rpm
pg_liquid_18 0.1.7 el9.aarch64 pigsty 61.8 KiB pg_liquid_18-0.1.7-1PIGSTY.el9.aarch64.rpm
pg_liquid_18 0.1.7 el10.x86_64 pigsty 65.0 KiB pg_liquid_18-0.1.7-1PIGSTY.el10.x86_64.rpm
pg_liquid_18 0.1.7 el10.aarch64 pigsty 62.4 KiB pg_liquid_18-0.1.7-1PIGSTY.el10.aarch64.rpm
postgresql-18-pg-liquid 0.1.7 d12.x86_64 pigsty 383.1 KiB postgresql-18-pg-liquid_0.1.7-1PIGSTY~bookworm_amd64.deb
postgresql-18-pg-liquid 0.1.7 d12.aarch64 pigsty 378.0 KiB postgresql-18-pg-liquid_0.1.7-1PIGSTY~bookworm_arm64.deb
postgresql-18-pg-liquid 0.1.7 d13.x86_64 pigsty 383.5 KiB postgresql-18-pg-liquid_0.1.7-1PIGSTY~trixie_amd64.deb
postgresql-18-pg-liquid 0.1.7 d13.aarch64 pigsty 378.6 KiB postgresql-18-pg-liquid_0.1.7-1PIGSTY~trixie_arm64.deb
postgresql-18-pg-liquid 0.1.7 u22.x86_64 pigsty 429.6 KiB postgresql-18-pg-liquid_0.1.7-1PIGSTY~jammy_amd64.deb
postgresql-18-pg-liquid 0.1.7 u22.aarch64 pigsty 427.6 KiB postgresql-18-pg-liquid_0.1.7-1PIGSTY~jammy_arm64.deb
postgresql-18-pg-liquid 0.1.7 u24.x86_64 pigsty 407.1 KiB postgresql-18-pg-liquid_0.1.7-1PIGSTY~noble_amd64.deb
postgresql-18-pg-liquid 0.1.7 u24.aarch64 pigsty 402.7 KiB postgresql-18-pg-liquid_0.1.7-1PIGSTY~noble_arm64.deb
postgresql-18-pg-liquid 0.1.7 u26.x86_64 pigsty 399.9 KiB postgresql-18-pg-liquid_0.1.7-1PIGSTY~resolute_amd64.deb
postgresql-18-pg-liquid 0.1.7 u26.aarch64 pigsty 399.6 KiB postgresql-18-pg-liquid_0.1.7-1PIGSTY~resolute_arm64.deb

Source

pig build pkg pg_liquid;		# 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_liquid;		# install via package name, for the active PG version

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

Create this extension with:

CREATE EXTENSION pg_liquid;

Usage

Source: Docs site, README, Release v0.1.7, SQL install script

pg_liquid brings Liquid-style graph and compound queries into PostgreSQL. It stores graph state in the liquid schema and exposes SQL entry points for plain queries, principal-bound queries, and least-privilege reads.

Core query surface

CREATE EXTENSION pg_liquid;

SELECT *
FROM liquid.query($$
  Edge("a","b").
  Edge("b","c").
  Path(X,Y) :- Edge(X,Y).
  Path(X,Y) :- Edge(X,Z), Path(Z,Y).
  Path("a",Y)?
$$) AS t(y text);
  • liquid.query(program text): executes Liquid facts, rules, and one terminal query.
  • liquid.query_as(principal text, program text): principal-bound execution.
  • liquid.read_as(principal text, program text): least-privilege read wrapper; intended for application-facing reads.

Language and modeling features

  • facts and rules terminated by .
  • one terminal ? query per program
  • graph edges via Edge(...)
  • typed compounds such as Type@(role=value, ...)
  • query-local recursive rules
  • built-in policy compounds such as CompoundReadByRole and liquid/acts_for

Row normalizers

SELECT liquid.create_row_normalizer(
  'account_profiles'::regclass,
  'account_profile_normalizer',
  'AccountProfile',
  '{"account_id":"id","display_name":"display_name","tier":"tier"}'::jsonb,
  true
);
  • liquid.create_row_normalizer(...): projects relational rows into Liquid compounds.
  • liquid.rebuild_row_normalizer(...): regenerates bindings after table changes.
  • liquid.drop_row_normalizer(...): removes the normalizer and optionally purges generated bindings.

Caveats

  • Upstream validates the extension on PostgreSQL 14 through 18.
  • query_as and read_as are revoked from PUBLIC in the shipped SQL; grant them deliberately.
  • read_as(...) is the safer application entry point when clients should not assert new facts.
Last updated on