[SCM] PostGIS branch stable-3.4 updated. 3.4.6-112-g95e296e07c
git at osgeo.org
git at osgeo.org
Mon Aug 3 09:31:56 PDT 2026
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".
The branch, stable-3.4 has been updated
via 95e296e07caee9db09979d124e5766fd7e186dba (commit)
via 9544c1a06417d49d300c2f9ddc368b47d1f0db8b (commit)
from ec446a2cb34ffcf2e2ee0fa9237f6f4b47097b2f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 95e296e07caee9db09979d124e5766fd7e186dba
Merge: ec446a2cb3 9544c1a064
Author: Darafei Praliaskouski <komzpa at gmail.com>
Date: Mon Aug 3 09:31:51 2026 -0700
Merge pull request 'Do not ANALYZE inside the extension upgrade transaction (stable-3.4)' (!660) from Komzpa/postgis:fix/no-analyze-in-extension-script-3.4-20260803 into stable-3.4
`stable-3.4` is red on the CI dashboard, and has been for 26 hours. The failure is
pipeline 6460, workflow `regress`, step `test-upgrades`:
```
FAIL: postgis_sfcgal extension upgrade 3.4.2--3.4.7dev!
...
DETAIL: Process 135651 waits for ShareUpdateExclusiveLock on relation 685754 ...;
blocked by process 135652.
Process 135652 waits for ShareLock on transaction 239369; blocked by process 135651.
CONTEXT: SQL statement "ALTER EXTENSION postgis UPDATE TO "ANY";
ALTER EXTENSION postgis UPDATE TO "3.4.7dev""
```
That is the deadlock already fixed on master by !650. This is that commit,
cherry-picked (`248b014b9`), with the NEWS entry rewritten for the 3.4.7 section and
this branch's style.
`spatial_ref_sys.sql` on this branch ends with the same three lines master had —
`ON CONFLICT (srid) DO NOTHING;` / `COMMIT;` / `ANALYZE "spatial_ref_sys";` — so the
bug and the fix are identical here. Checked by running the substitution against this
branch's file: with the current rule the generated extension script still ends in
`ANALYZE "spatial_ref_sys";`, and with the new rule it contains no `ANALYZE` line at
all.
No CI configuration is added or changed on this branch; this only fixes the script
generation that makes an existing check red.
Reviewed-on: https://gitea.osgeo.org/postgis/postgis/pulls/660
commit 9544c1a06417d49d300c2f9ddc368b47d1f0db8b
Author: Darafei Praliaskouski <me at komzpa.net>
Date: Sun Aug 2 20:03:01 2026 +0400
Do not ANALYZE inside the extension upgrade transaction
spatial_ref_sys.sql ends with
ON CONFLICT (srid) DO NOTHING;
COMMIT;
ANALYZE "spatial_ref_sys";
The ANALYZE sits after COMMIT on purpose: run standalone it refreshes the
statistics of a table that just gained thousands of rows, outside any
transaction. The extension build strips BEGIN and COMMIT because those are
not allowed in extension scripts, and left the ANALYZE behind — so it ends up
*inside* the upgrade's transaction, takes ShareUpdateExclusiveLock on
spatial_ref_sys, and can deadlock against autovacuum analysing the same table:
ERROR: deadlock detected
DETAIL: Process A waits for ShareUpdateExclusiveLock on relation ...;
blocked by process B. Process B waits for ShareLock on
transaction ...; blocked by process A.
CONTEXT: SQL statement "ANALYZE "spatial_ref_sys""
extension script file "postgis--ANY--3.7.0dev.sql"
That aborts ALTER EXTENSION postgis UPDATE, so a user upgrading a busy
database can simply lose the upgrade. It also accounts for three of the
eleven most recent Woodpecker pipeline failures, in regress/test-install and
regress/test-upgrades, on ordinary amd64 rows rather than emulated ones.
Strip the ANALYZE along with the transaction control it was written to follow.
The standalone spatial_ref_sys.sql keeps it; autovacuum analyses the table on
its own schedule, so the extension script does not need to.
(cherry picked from commit 248b014b9805911792e2fcc097ce7c0cde422308)
diff --git a/NEWS b/NEWS
index 86a12e5f66..361f4b074e 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,9 @@ PostGIS 3.4.7
* Bug Fixes *
+ - Stop the extension upgrade script running ANALYZE inside its
+ transaction, where it could deadlock with autovacuum analysing
+ spatial_ref_sys (Darafei Praliaskouski)
- GT-569, Initialize GSERIALIZED peek test fixtures so check-unit stays
clean under Valgrind (Darafei Praliaskouski)
- GT-575, Scope interrupt regression timeouts to the statements being
diff --git a/extensions/postgis/Makefile.in b/extensions/postgis/Makefile.in
index 4814afe368..2436c5725c 100644
--- a/extensions/postgis/Makefile.in
+++ b/extensions/postgis/Makefile.in
@@ -106,9 +106,21 @@ sql/$(EXTENSION)--unpackaged.sql: Makefile | sql
sql:
mkdir -p $@
-#strip BEGIN/COMMIT since these are not allowed in extensions
+# Strip BEGIN/COMMIT since these are not allowed in extensions, and the trailing
+# ANALYZE with them. In spatial_ref_sys.sql that ANALYZE deliberately sits *after*
+# COMMIT, so run standalone it refreshes statistics outside any transaction. Removing
+# only the COMMIT moves it inside the extension's transaction, where it takes
+# ShareUpdateExclusiveLock on spatial_ref_sys and can deadlock against autovacuum
+# doing the same work:
+#
+# ERROR: deadlock detected
+# CONTEXT: SQL statement "ANALYZE "spatial_ref_sys""
+# extension script file "postgis--ANY--<version>.sql"
+#
+# That aborts ALTER EXTENSION postgis UPDATE on any busy database. Autovacuum will
+# analyse the table on its own schedule, so the extension script does not need to.
sql/spatial_ref_sys.sql: ../../spatial_ref_sys.sql | sql
- $(PERL) -pe 's/BEGIN\;//g ; s/COMMIT\;//g' $< > $@
+ $(PERL) -pe 's/BEGIN\;//g ; s/COMMIT\;//g ; s/^ANALYZE "spatial_ref_sys";\s*$$//g' $< > $@
../../doc/postgis_comments.sql:
$(MAKE) -C ../../doc comments
-----------------------------------------------------------------------
Summary of changes:
NEWS | 3 +++
extensions/postgis/Makefile.in | 16 ++++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list