Skip to content

pg_ladybug

Cypher queries over PostgreSQL tables through an embedded Ladybug graph engine.

pg_ladybug · Cypher queries over PostgreSQL tables through an embedded Ladybug graph engine.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
101913pg_ladybugpg_ladybug1.0FEATPostgreSQLC

PostgreSQL · 17, 18

Usage

Sources:

pg_ladybug Cypher queries over PostgreSQL tables through an embedded Ladybug graph engine.

Enablement

Install the files for the intended server, then create pg_ladybug in the target database:

CREATE EXTENSION pg_ladybug;

Core Workflow

The following example is taken from the reviewed upstream documentation. Adapt object names, paths, credentials, and workload values before use.

┌─────────────────────────────────────────────┐
│          PostgreSQL backend                  │
│                                              │
│  Cypher query → ladybug.cypher()             │
│       │                                      │
│       ▼                                      │
│  Ladybug planner (liblbug, compile-time      │
│  linked via -llbug)                          │
│    - Parse Cypher                            │
│    - Discover tables via pg_client           │
│      (libpq → information_schema)            │
│    - Produce EXPLAIN plan                    │
│       │                                      │
│       ▼                                      │
│  extract_pushed_sql()                        │
│    - Parse plan text                         │
│    - Extract "Function:" section (SQL)       │
│    - OR construct SELECT from plan nodes     │
│       │                                      │
│       ▼                                      │
│  SPI_execute(pushed_sql)                     │
│    - Native Postgres execution               │
│    - Return rows via SRF                     │
│                                              │
└─────────────────────────────────────────────┘

Main Objects

The reviewed install surface includes these prominent objects:

ObjectKindOperational role
ladybug.cypherFUNCTIONCallable function from the reviewed install surface.
ladybug.explainFUNCTIONCallable function from the reviewed install surface.
ladybug.pushed_sqlFUNCTIONCallable function from the reviewed install surface.
ladybug.register_nodeFUNCTIONCallable function from the reviewed install surface.
ladybug.register_edgeFUNCTIONCallable function from the reviewed install surface.
ladybug.list_labelsFUNCTIONCallable function from the reviewed install surface.
ladybug.reset_graphFUNCTIONCallable function from the reviewed install surface.
ladybug.sql_queryFUNCTIONCallable function from the reviewed install surface.

Operations and Boundaries

  • The verified PostgreSQL-major evidence covers 17, 18; do not infer unlisted majors.
  • The extension fixes or creates schema objects under ladybug; include them in privilege and backup review.

Table reader