Skip to content

pg_statecharts_dev

SCXML import and migration tooling for pg_statecharts

Overview

PackageVersionCategoryLicenseLanguage
pg_statecharts0.1.0FEATMITSQL
IDExtensionBinLibLoadCreateTrustRelocSchema
2695pg_statechartsNoNoNoYesNoNofsm
2696pg_statecharts_devNoNoNoYesNoNofsm

Development tooling; server file privileges

Version

TypeRepoVersionPG VerPackageDeps
EXTPIGSTY0.1.01817161514pg_statechartspg_statecharts
RPMPIGSTY0.1.01817161514pg_statecharts_dev_$vpg_statecharts_$v
DEBPIGSTY0.1.01817161514postgresql-$v-pg-statecharts-devpostgresql-$v-pg-statecharts
OS / PGPG18PG17PG16PG15PG14
el8.x86_64PIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/AN/A
el8.aarch64PIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/AN/A
el9.x86_64PIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/AN/A
el9.aarch64PIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/AN/A
el10.x86_64PIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/AN/A
el10.aarch64PIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/AN/A
d12.x86_64PIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/AN/A
d12.aarch64PIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/AN/A
d13.x86_64PIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/AN/A
d13.aarch64PIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/AN/A
u22.x86_64PIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/AN/A
u22.aarch64PIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/AN/A
u24.x86_64PIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/AN/A
u24.aarch64PIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/AN/A
u26.x86_64PIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/AN/A
u26.aarch64PIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/AN/A

Build

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

pig build pkg pg_statecharts         # build RPM / DEB packages

Install

You can install pg_statecharts 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:

Install
pig install pg_statecharts;          # Install for current active PG version
pig
pig ext install -y pg_statecharts -v 18  # PG 18
pig ext install -y pg_statecharts -v 17  # PG 17
pig ext install -y pg_statecharts -v 16  # PG 16
dnf
dnf install -y pg_statecharts_dev_18       # PG 18
dnf install -y pg_statecharts_dev_17       # PG 17
dnf install -y pg_statecharts_dev_16       # PG 16
apt
apt install -y postgresql-18-pg-statecharts-dev   # PG 18
apt install -y postgresql-17-pg-statecharts-dev   # PG 17
apt install -y postgresql-16-pg-statecharts-dev   # PG 16

Create Extension:

CREATE EXTENSION pg_statecharts_dev CASCADE;  -- requires: pg_statecharts

Usage

Sources:

pg_statecharts_dev 0.1.0 is the development companion to pg_statecharts. It imports SCXML definitions and generates Sqitch migrations. The production state-machine runtime does not need this file-access tooling.

Core Workflow

After installing the runtime and its dependency, enable the companion:

CREATE EXTENSION pg_statecharts_dev;
SELECT * FROM fsm.import_scxml_files(
  source_path => '/repo/statecharts',
  recursive => false,
  on_conflict_do_nothing => false
);

The source directory is on the database host. Statechart callbacks must exist with the expected signatures. Parse or validation failures roll back the import transaction instead of accepting part of a chart.

Migration Generation

SELECT fsm.gen_statechart_sqitch_migrations(
  source_path => '/repo/statecharts',
  sqitch_plan_file_path => '/repo/sqitch/sqitch.plan',
  recursive => false
);

Create the destination directories before generation and make them accessible to the database OS user. The generator writes deploy, revert and verify scripts, updates the plan, and can overwrite existing generated chart files. Review the changes before using them as application migrations.

Permissions and Boundaries

Server file reads require pg_read_server_files; writes require pg_write_server_files. These are broad privileges, not a sandbox restricted to the supplied path. Restrict the extension and roles to a controlled development database. It shares the fsm schema, is pure SQL and requires no preload; PostgreSQL 16–18 are the documented test targets.

Use the runtime’s current semantic-version helpers in generated migrations. For old migrations that cast to the removed semver type, follow the upstream migration guide; regenerating every historical chart can introduce callback-order failures. Deploy reviewed generated SQL to production without installing this companion there.

Was this page helpful?

Table reader