Opened 6 months ago

Closed 6 months ago

Last modified 6 months ago

#5493 closed enhancement (fixed)

No tools are given to resolve presence of deprecated functions

Reported by: strk Owned by: strk
Priority: medium Milestone: PostGIS 3.4.1
Component: build Version: 3.4.x
Keywords: Cc:

Description

Presence of deprecated functions is reported by postgis_full_version() but no tools are given to resolve that situation.

An HINT about how to resolve the situation is given when those deprecated functions are created, that is on the very upgrade being performed, and the HINT suggests to re-define the views and "upgrade again", but upgrading again currently does not even try to drop those deprecated functions and thus also fails to report any problem with doing so with associated HINT about it.

I suggest we make the upgrade script always try to delete all deprecated functions rather than only those created by the upgrade script itself (which is what is happening now)

Change History (8)

comment:1 by strk, 6 months ago

Summary: Non tools are given to resolve presence of deprecated functionsNo tools are given to resolve presence of deprecated functions

I would add that upgrading again BEFORE manually dropping those functions currently errors out by finding the

comment:2 by strk, 6 months ago

Sorry for the partial comment, I meant upgrading BEFORE manually dropping the deprecated functions currently errors out with something like:

ERROR: Attempting to rename replaced function st_dwithin(geometry, geometry, float8) got function st_dwithin_deprecated_by_postgis_200(geometry, geometry, double precision) already exists in schema "public" (42723)

Maybe the upgrader could catch that exception and hint the user about the need to resolve the situation, after trying to resolve it itself.

comment:3 by strk, 6 months ago

Resolution: invalid
Status: newclosed

I tried to confirm what I said in previous commit but right now I'm looking at a case in which continuously running an upgrade continuously warns me about functions being left behind, which is perfectly fine for the warning part. This is to say I'm not getting any error, and I guess the error I was seeing was fully due to the bug reported in #5494

The upgrade procedure is PERFECT in that it's enough to follow the HINT (drop views and upgrade again) to actually see those deprecated functions being removed.

All working as expected.

comment:4 by strk, 6 months ago

I confirm the error with "target function already exists" is due to the deprecated function still being in the database, and the only reason why a deprecated function is still in the database is because we are re-adding it, which is what is happening while being affected by issue #5494:

ERROR: Attempting to rename replaced function st_dwithin(text, text, float8) got function st_dwithin_deprecated_by_postgis_300(text, text, double precision) already exists in schema "public" (42723)

comment:5 by strk, 6 months ago

It would be nice if CI could catch this problem (currently does not): #5497

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

In 8db5546/git:

Use a common before/after upgrade script for core and raster

References #5493

comment:7 by Sandro Santilli <strk@…>, 6 months ago

In 684daa9/git:

Have _postgis_drop_function_if_needed rename rather than drop

Renames functions to have suffix _deprecated_by_postgis_<version>
Version becomes an optional parameter.

References #5493

comment:8 by Sandro Santilli <strk@…>, 6 months ago

Resolution: invalidfixed

In e428b70/git:

Backport all fixes to deal with upgrades in presence of views

  • Use a common before/after upgrade script for core and raster: rename deprecated funx before, drop them (if possible) after
  • Properly encode all deprecation from 2.5 onward
  • Update run_test.pl to support double upgrades and give hints upon leaving functions in the database

In 3.4 branch (3.4.1dev):

closes #5493 #5502 #5503 #5504 #5505 #5506 #5507 #5508 #5509 #5510

#5511 #5512 #5513 #5514 #5515 #5516 #5516 #5517 #5523 #5524

Note: See TracTickets for help on using tickets.