Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#5202 closed defect (fixed)

It seems I can downgrade with ANY

Reported by: robe Owned by: robe
Priority: blocker Milestone: PostGIS 3.2.3
Component: build Version: 3.2.x
Keywords: Cc:

Description

I thought we had protection for this, but maybe the protection is only in the

ALTER EXTENSION .. UPDATE;

machinery.

To test, I installed postgis 3.3.0dev.

CREATE EXTENSION postgis;

Then followed by installing postgis 3.2.2.

Then run:

SELECT postgis_extensions_upgrade();

Downgraded me to 3.2.2.

You can do the same by messing with the control files

Change History (16)

comment:1 by robe, 2 years ago

Owner: changed from strk to robe

comment:2 by Regina Obe <lr@…>, 2 years ago

Resolution: fixed
Status: newclosed

In 2f08c4f/git:

1) Only use ANY option if superuser installing
2) Don't allow downgrade
3) Schema qual changes
Closes #5194 for PostGIS 3.3.0
Closes #5202 for PostGIS 3.3.0

comment:3 by strk, 2 years ago

Milestone: PostGIS 3.3.0PostGIS 3.2.3
Resolution: fixed
Status: closedreopened
Version: master3.2.x

The protection should actually be in the upgrade script itself (postgis_upgrade.sql). If you can downgrade by loading postgis_upgrade.sql then this bug is not fixed yet.

The bug still exists, and is in the older postgis version. Didn't check how old but I was able to install 3.3.0dev and downgrade to 3.2.3dev

comment:4 by strk, 2 years ago

Ok I went looking the code and it does indeed NOT attempt to protect against downgrade, but ONLY against "upgrades" between different _major_ versions. Being 3.3 and 3.2 both in the same "major" version the upgrade script does not complain.

comment:5 by Sandro Santilli <strk@…>, 2 years ago

In 497e7934/git:

Guard against downgrades

References #5202 in master branch (3.3.0dev)

comment:6 by Sandro Santilli <strk@…>, 2 years ago

In 60244502/git:

Guard against downgrades

References #5202 in 3.2 branch (3.2.3dev)

comment:7 by Sandro Santilli <strk@…>, 2 years ago

In c885bc7/git:

Consider full version when guarding against downgrades

References #5202 in master branch (3.3.0dev)

comment:8 by Sandro Santilli <strk@…>, 2 years ago

In 1f3c83b4/git:

Consider full version when guarding against downgrades

References #5202 in 3.2 branch (3.2.3dev)

comment:9 by Sandro Santilli <strk@…>, 2 years ago

In 7d50d1b/git:

Fix extraction of integer array version on upgrade

References #5202 in master branch (3.3.0dev)

comment:10 by Sandro Santilli <strk@…>, 2 years ago

In a04d348c/git:

Fix extraction of integer array version on upgrade

References #5202 in 3.2 branch (3.2.3dev)

comment:11 by Sandro Santilli <strk@…>, 2 years ago

In 07f6b5f/git:

Guard against downgrades

References #5202 in 3.1 branch (3.1.7dev)

comment:12 by Sandro Santilli <strk@…>, 2 years ago

In 1c3ae91/git:

Guard against downgrades

References #5202 in 3.0 branch (3.0.7dev)

comment:13 by Sandro Santilli <strk@…>, 2 years ago

Resolution: fixed
Status: reopenedclosed

In be4c7b6/git:

Guard against downgrades

Closes #5202 in 2.5 branch (2.5.8dev)

comment:14 by strk, 2 years ago

Regina this is now fixed properly, but we still don't have any CI test to check that downgrades are not possible. I may add the test to utils/check_all_upgrades.sh or create another script utils/check_all_downgrades.sh . Maybe we should have another ticket for this

comment:15 by strk, 2 years ago

For the record: the backport to 2.5 broke something, see #5203 (ci is green in later branches)

comment:16 by Sandro Santilli <strk@…>, 2 years ago

In e5f7f23/git:

Fix syntax of major upgrade function

This was broken in previous commit
be4c7b69d697d0819aa68b8ca3af39a95936c1eb

References #5202
Closes #5203

Note: See TracTickets for help on using tickets.