pgschema
pgschema copied to clipboard
Terraform-style, declarative Postgres schema migration. Agent friendly.
## Summary Partial indexes whose `WHERE` predicate uses an `IN`-list on a `varchar` column produce a perpetual spurious diff: `dump` renders the predicate as `IN (...)`, but PostgreSQL stores it...
When dumping a schema containing a restrictive RLS policy, the dump omits `AS RESTRICTIVE`, causing the policy to be recreated as the default permissive policy. ## Repro SQL code ```sql...
Something I'm hitting consistently with my current project. The simplest reproduction I have is: table
## Summary On current `main`, `pgschema apply` succeeds for a trigger whose `WHEN` expression contains same-schema enum casts, but an immediate repeat `pgschema plan` still wants to recreate the same...
Inspector/IR should preserve schema identity for type references (enable --qualify-schema for types)
Follow-up from PR #492 (`dump --qualify-schema`). `--qualify-schema` forces full schema qualification for **object identifiers** (table/view/index/sequence/type/function/procedure/policy names, and `ON` / `REFERENCES` / `OWNED BY` / `COMMENT` targets). That covers the reserved-word/ambiguity...
## Summary When `pgschema apply` builds a **partitioned table** whose `UNIQUE`/`PRIMARY KEY` is declared **on the parent**, it creates each partition child's constraint as a **local** constraint (`pg_constraint.conislocal = true`,...
## Summary When `pgschema apply` builds a partitioned table **from scratch**, it creates the parent correctly (`PARTITION BY ...`) but creates every child as a **detached, standalone plain table**. It...
## Context PR #498 (issue #496) changed the create path for partition children from standalone `CREATE TABLE` to `CREATE TABLE ... PARTITION OF ... FOR VALUES ...`. This correctly attaches...
## Summary PostgreSQL 18 `VIRTUAL` generated columns in the desired-state file are silently rewritten into `DEFAULT` expressions in the plan. Since a `DEFAULT` cannot reference other columns, the generated DDL...
## Summary When a table has the same name as the target schema, `pgschema plan` misresolves two-part `COMMENT ON COLUMN` names in the desired-state SQL. SQL semantics for `COMMENT ON...