github.com/stripe/pg-schema-diff
v1.0.9
#1957 most downloaded on Go modules
stripe/pg-schema-diff
What this package is like to depend on
Last release 18 days ago
06 Aug 2026
Release timing varies
gaps range from 8 days to 6 months
Some releases are documented
notes for 10 of 22 stable releases
Nothing withdrawn
no release was ever pulled
3 years old
57 releases · first in 2023
10 releases in the last 12 months
see the full history below
Release timeline
57 releases · Jun 2023 to Aug 2026Releases
latest 57-
v1.0.906 Aug 2026Release notes
Open source →Fix: Materialized view reconstruction uses WITH NO DATA
During plan validation,
setSchemaForEmptyDatabasereconstructs the source schema in a temporary database. For materialized views, theAdd()method previously emittedCREATE MATERIALIZED VIEW ... AS <query>withoutWITH NO DATA, causing Postgres to execute the view's stored query. This is unnecessary (the temp DB is discarded immediately) and potentially unsafe.Changes
- Append
WITH NO DATAto allCREATE MATERIALIZED VIEWDDL generated during schema reconstruction - Strip trailing semicolons from
pg_get_viewdef()output to prevent syntax errors when appendingWITH NO DATA
Files changed
pkg/diff/materialized_view_sql_generator.gopkg/diff/schema_migration_plan_test.go(3 new unit tests)
Full PR: #305
- Append
-
v1.0.828 Jul 2026Release notes
Open source →Security fix
Fixes search_path shadowing in bigint-to-timestamp column migrations (CVE-2018-1058, #298).
Bigint → timestamp
USINGclause (sql_generator.go)When migrating a
bigintcolumn totimestamp without time zone, pg-schema-diff emits ato_timestamp()call in theALTER COLUMN ... USINGclause. An unqualified call resolves viasearch_path, so a user withCREATEon a schema can plant shadow functions that run during apply instead of the built-ins.Fix: emit a fully qualified expression:
pg_catalog.to_timestamp( col::pg_catalog.float8 OPERATOR(pg_catalog./) 1000.0::pg_catalog.float8 )
What's Changed
- fix: qualify pg_catalog.to_timestamp in bigint-to-timestamp migrations (#298)
Full Changelog: v1.0.7...v1.0.8
-
v1.0.703 Jul 2026Release notes
Open source →Security fixes
Fixes two additional SQL injection sinks identified via the same root cause as v1.0.6 (enum labels, #295). Schema-derived values were re-emitted into generated DDL without proper escaping.
Policy role names (
policy_sql_generator.go)AppliesTorole names (sourced frompg_roles.rolname) were interpolated raw intoCREATE POLICY ... TOandALTER POLICY ... TOstatements. A user withCREATEROLEprivilege could plant a role whose name contains an embedded double-quote to inject arbitrary SQL during plan execution.Fix: Added
escapeRoleNames()helper that appliesEscapeIdentifierto each role name, preservingPUBLICas an unquoted SQL keyword.Function/procedure names (
schema.gobuildProcName)The function used hand-rolled quoting (
fmt.Sprintf("\"%s\"(%s)", name, ...)) that did not double embedded double-quotes. A user withCREATE FUNCTIONprivilege could create a function with"in its name to inject SQL whenDROP FUNCTION/DROP PROCEDUREstatements are generated.Fix: Replaced the hand-rolled quoting with
EscapeIdentifier(name).What's Changed
- fix: escape policy role names and function/procedure names in generated SQL (#296)
Full Changelog: v1.0.6...v1.0.7
-
v1.0.603 Jul 2026Release notes
Open source →Security fix
Escapes enum labels in generated SQL to prevent a second-order SQL injection.
Enum labels were interpolated into generated DDL using raw
fmt.Sprintf("'%s'", val). A label containing a single quote could break out of the string literal and inject arbitrary SQL, which then executes with the plan runner's (often superuser) privileges whenpg-schema-diffgenerates migration SQL — enabling RCE viaCOPY ... TO PROGRAM.All three enum sinks (
CREATE TYPE ... AS ENUM,ALTER TYPE ... ADD VALUE, and theBEFOREordering clause) now route through a newEscapeLiteralhelper that doubles single quotes and strips null bytes.See #295 for details and test evidence.
Recommendation: upgrade to
v1.0.6, especially if you runpg-schema-diffagainst databases where lower-privileged users can create enum types. -
v1.0.507 Jan 2026Release notes
Open source → -
v1.0.407 Jan 2026Release notes
Open source → -
v1.0.331 Dec 2025Release notes
Open source →What's Changed
- Materialized view index support by @bplunkett-stripe in #262
- Add volatile default requires full table rewrite hazard by @catatsuy in #258
- Bump to go 1.25 by @bplunkett-stripe in #260
- chore: fix typos by @noritaka1166 in #243
- Use pgx escape identifier by @bplunkett-stripe in #256
- Switch from alpine to debian by @bplunkett-stripe in #259
- Cleanup by @bplunkett-stripe in #261
New Contributors
- @noritaka1166 made their first contribution in #243
- @catatsuy made their first contribution in #258
Full Changelog: v1.0.2...v1.0.3
-
v1.0.3-0.20250902170109-996618536f9002 Sep 2025 pre-releaseNothing published for this version
-
v1.0.202 Sep 2025Release notes
Open source →What's Changed
- Ensure command prints to stdout by @bplunkett-stripe in #245
Full Changelog: v1.0.1...v1.0.2
-
v1.0.101 Sep 2025Release notes
Open source →What's Changed
- Update readme by @bplunkett-stripe in #240
- Fix: Support
GENERATED ALWAYS AScolumns to reduce migration failures (#212) by @lmcrean in #232 - Add option to disable concurrent index build/drops by @geeknonerd and @bplunkett-stripe in #242
New Contributors
Full Changelog: v1.0.0...v1.0.1
-
v1.0.1-0.20250827201201-3efa9b9908f927 Aug 2025 pre-releaseNothing published for this version
-
v1.0.1-0.20250826210422-f40bbbe945f826 Aug 2025 pre-releaseNothing published for this version
-
v1.0.025 Aug 2025Release notes
Open source →Releasing first major version, since the API has stabilized.
What's Changed
- SQL format default by @bplunkett-stripe in #239
Full Changelog: v0.9.3...v1.0.0
-
v0.9.325 Aug 2025Nothing published for this version
-
v0.9.3-0.20250825083957-bed0fd3a2d4625 Aug 2025 pre-releaseNothing published for this version
-
v0.9.3-0.20250825080945-b34c69e5474325 Aug 2025 pre-releaseNothing published for this version
-
v0.9.3-0.20250811161054-bd40c7b3a92511 Aug 2025 pre-releaseNothing published for this version
-
v0.9.3-0.20250811045153-083748e7999e11 Aug 2025 pre-releaseNothing published for this version
-
v0.9.211 Aug 2025Nothing published for this version
-
v0.9.120 Jul 2025Nothing published for this version
-
v0.9.1-0.20250331204010-2f423254bdb631 Mar 2025 pre-releaseNothing published for this version
-
v0.9.011 Feb 2025Nothing published for this version
-
v0.8.1-0.20241211224935-34273e554e3b11 Dec 2024 pre-releaseNothing published for this version
-
v0.8.1-0.20241211011934-72e3df547e6711 Dec 2024 pre-releaseNothing published for this version
-
v0.8.1-0.20241127202941-21fab6a86bb127 Nov 2024 pre-releaseNothing published for this version
-
v0.8.002 Oct 2024Nothing published for this version
-
v0.7.1-0.20241002190658-9216a8f3c22402 Oct 2024 pre-releaseNothing published for this version
-
v0.7.1-0.20240921002210-f036cb2d903d21 Sep 2024 pre-releaseNothing published for this version
-
v0.7.1-0.20240911170548-bc41f09a549511 Sep 2024 pre-releaseNothing published for this version
-
v0.7.1-0.20240904160938-6937348e798204 Sep 2024 pre-releaseNothing published for this version
-
v0.7.1-0.20240831073412-6ca546f053a231 Aug 2024 pre-releaseNothing published for this version
-
v0.7.1-0.20240723161711-c63b0b73676723 Jul 2024 pre-releaseNothing published for this version
-
v0.7.1-0.20240708203710-e5eafa80e4eb08 Jul 2024 pre-releaseNothing published for this version
-
v0.7.1-0.20240705155903-8509c7f051da05 Jul 2024 pre-releaseNothing published for this version
-
v0.7.1-0.20240610165506-9dd9ece7983b10 Jun 2024 pre-releaseNothing published for this version
-
v0.7.1-0.20240530162545-41c8479d16b630 May 2024 pre-releaseNothing published for this version
-
v0.7.029 May 2024Nothing published for this version
-
v0.6.1-0.20240506155055-6319a93cc77706 May 2024 pre-releaseNothing published for this version
-
v0.6.1-0.20240403180654-2a242c0dc03c03 Apr 2024 pre-releaseNothing published for this version
-
v0.6.1-0.20240329234725-84422a16d2bd29 Mar 2024 pre-releaseNothing published for this version
-
v0.6.1-0.20240321185415-20140e865dcc21 Mar 2024 pre-releaseNothing published for this version
-
v0.6.1-0.20240313040624-0492c3e282e913 Mar 2024 pre-releaseNothing published for this version
-
v0.6.1-0.20240219234134-b71f162b3cb919 Feb 2024 pre-releaseNothing published for this version
-
v0.6.008 Feb 2024Nothing published for this version
-
v0.5.1-0.20240208235840-7fc1d07ba7c308 Feb 2024 pre-releaseNothing published for this version
-
v0.5.1-0.20240207201929-97fffc899c9007 Feb 2024 pre-releaseNothing published for this version
-
v0.5.1-0.20240205075200-43a6d6f69ebd05 Feb 2024 pre-releaseNothing published for this version
-
v0.5.1-0.20240201190705-e10c39e5273201 Feb 2024 pre-releaseNothing published for this version
-
v0.5.011 Jan 2024Nothing published for this version
-
v0.4.1-0.20240111164928-16eed43477cf11 Jan 2024 pre-releaseNothing published for this version
-
v0.4.025 Oct 2023Nothing published for this version
-
v0.3.1-0.20230824160948-8e25688f004824 Aug 2023 pre-releaseNothing published for this version
-
v0.3.1-0.20230810222005-73d2361e627410 Aug 2023 pre-releaseNothing published for this version
-
v0.3.010 Aug 2023Nothing published for this version
-
v0.2.007 Jul 2023Nothing published for this version
-
v0.1.1-0.20230707165844-a0d7b848112907 Jul 2023 pre-releaseNothing published for this version
-
v0.1.002 Jun 2023Nothing published for this version