Skip to content

pg_statecharts_dev

SCXML import and migration tooling for pg_statecharts

pg_statecharts · SCXML import and migration tooling for pg_statecharts

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
2696pg_statecharts_devpg_statecharts0.2.0FEATMITSQL
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
----d--NoNoNoYesnono
Relationships
Schemasfsm
Requirespg_statecharts
Siblingspg_statecharts
Development tooling; server file privileges

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY0.2.019 18 17 16 15pg_statechartspg_statecharts
RPMPIGSTY0.2.019 18 17 16 15pg_statecharts_dev_$vpg_statecharts_$v
DEBPIGSTY0.2.019 18 17 16 15postgresql-$v-pg-statecharts-devpostgresql-$v-pg-statecharts
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/A
el8.aarch64N/APIGSTY 0.1.0PIGSTY 0.1.0PIGSTY 0.1.0N/A
el9.x86_64PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0N/A
el9.aarch64PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0N/A
el10.x86_64PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0N/A
el10.aarch64PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0N/A
d12.x86_64PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0N/A
d12.aarch64PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0N/A
d13.x86_64PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0N/A
d13.aarch64PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0N/A
u22.x86_64PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0N/A
u22.aarch64PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0N/A
u24.x86_64PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0N/A
u24.aarch64PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0N/A
u26.x86_64PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0N/A
u26.aarch64PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0PIGSTY 0.2.0N/A

Source

pig build pkg pg_statecharts;		# 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_statecharts;		# install by package name
pig install pg_statecharts_dev;		# install by extension name

pig install pg_statecharts_dev -v 19;   # install for PG 19
pig install pg_statecharts_dev -v 18;   # install for PG 18
pig install pg_statecharts_dev -v 17;   # install for PG 17
pig install pg_statecharts_dev -v 16;   # install for PG 16

Create this extension with:

CREATE EXTENSION pg_statecharts_dev CASCADE; -- requires pg_statecharts

Usage

Sources:

pg_statecharts_dev 0.2.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.

Paired 0.2.0 Upgrade

Keep this companion and pg_statecharts on the same release. Install both sets of SQL files, update the runtime first, then run ALTER EXTENSION pg_statecharts_dev UPDATE;. The companion’s 0.1.0 to 0.2.0 script makes no object changes; its version follows the runtime. Review runtime positional calls before upgrading because the runtime moved the shard argument to the end. A dependency declaration alone does not enforce matching extension versions.

Table reader