Opened 2 years ago

Last modified 2 years ago

#5253 closed defect

postgis_extensions_upgrade is broken for upgrade from 3.4.0dev to 3.4.0dev — at Version 3

Reported by: robe Owned by: strk
Priority: blocker Milestone: PostGIS 3.4.0
Component: build Version: master
Keywords: Cc:

Description (last modified by robe)

I guess we don't have a test for this cause the test should have caught it.

When I run this on my setup after a fresh install of 3.4.0dev

SELECT postgis_extensions_upgrade();

I get this error:

NOTICE:  Updating extension postgis 3.4.0dev

ERROR:  syntax error at or near "ANY"
LINE 1: ...TENSION "ALTER EXTENSION %1$I UPDATE TO %2$I" UPDATE TO ANY;
                                                                   ^
QUERY:  ALTER EXTENSION "ALTER EXTENSION %1$I UPDATE TO %2$I" UPDATE TO ANY;
CONTEXT:  PL/pgSQL function postgis_extensions_upgrade() line 89 at EXECUTE
SQL state: 42601

On closer inspection, the problem is this format expression:

			sql = format(
				'ALTER EXTENSION %1$I UPDATE TO ANY;',
				'ALTER EXTENSION %1$I UPDATE TO %2$I',
				rec.name, target_version
				);

I think should be:

			sql = format(
				'ALTER EXTENSION %1$I UPDATE TO "ANY";'
				'ALTER EXTENSION %1$I UPDATE TO %2$I',
				rec.name, target_version
				);

Change History (3)

comment:1 by robe, 2 years ago

Description: modified (diff)

comment:2 by robe, 2 years ago

We should also add a test for this, but not sure which would be the appropriate since it covers all extensions.

comment:3 by robe, 2 years ago

Description: modified (diff)

oops I changed the wrong example the ANY also needs to be single or double quoted. Easier to double-quote

Note: See TracTickets for help on using tickets.