Opened 11 months ago

Last modified 10 months ago

#5648 reopened defect

postgis_raster upgrade fails on PG16

Reported by: rdunklau Owned by: robe
Priority: blocker Milestone: PostGIS 3.3.6
Component: raster Version: 3.4.x
Keywords: Cc:

Description (last modified by rdunklau)

postgis_raster upgrade fails on PG16 with the error message:

ERROR: attempt to redefine parameter "postgis.gdal_datapath"

This comes from the implementation of postgis_guc_find_option for PG16, which passes a random address instead of the GUC name.

Here is a real simple patch fixing that:

diff --git a/libpgcommon/lwgeom_pg.c b/libpgcommon/lwgeom_pg.c
index 6af4bea39..f7f848adc 100644
--- a/libpgcommon/lwgeom_pg.c
+++ b/libpgcommon/lwgeom_pg.c
@@ -521,7 +521,7 @@ postgis_guc_find_option(const char *name)
         * the name field is first in config_generic.
         */
 #if POSTGIS_PGSQL_VERSION >= 160
-       res = (struct config_generic **) find_option((void *) &key, false, true, ERROR);
+       res = (struct config_generic **) find_option((void *) name, false, true, ERROR);
 #else
        res = (struct config_generic **) bsearch((void *) &key,
                 (void *) get_guc_variables(),
-- 
2.43.0

One should probably remove the cast to (void *) while at it

Change History (12)

comment:1 by robe, 11 months ago

Component: postgisraster
Owner: changed from pramsey to robe

comment:2 by rdunklau, 11 months ago

Description: modified (diff)

comment:3 by Regina Obe <lr@…>, 11 months ago

In bfc8cd7/git:

Fix for postgis raster PG 16 guc
References #5648 for PostGIS 3.5.0
patch from Ronan Dunklau

comment:4 by robe, 11 months ago

Milestone: PostGIS 3.4.2PostGIS 3.3.6

comment:5 by Regina Obe <lr@…>, 11 months ago

In b0943c0/git:

Fix for postgis raster PG 16 guc
References #5648 for PostGIS 3.4.2
patch from Ronan Dunklau

comment:6 by Regina Obe <lr@…>, 11 months ago

Resolution: fixed
Status: newclosed

In d27577a0/git:

Fix for postgis raster PG 16 guc
Closes #5648 for PostGIS 3.3.6
patch from Ronan Dunklau

comment:7 by robe, 11 months ago

Resolution: fixed
Status: closedreopened

comment:8 by Regina Obe <lr@…>, 11 months ago

In 18e7f66c/git:

Revert #5648 fix
Causing regression failures on PG16 and PG17
References #5648 and #5650

comment:9 by robe, 11 months ago

I rolled back this change on master, cause it was breaking our upgrade tests and several raster tests (with can't change guc) as noted in #5650. The upgrade tests failing are more mysterious to me.

I also left a dangling variable key, but that was a separate issue which fixing that did not fix the underlying issue in #5650.

I'm still checking to see if it's our tests at fault here, cause looking at the definition in PostgreSQL code

struct config_generic *
find_option(const char *name, bool create_placeholders, bool skip_errors,
			int elevel)

This code should have worked

comment:10 by robe, 11 months ago

Priority: mediumblocker

comment:11 by Regina Obe <lr@…>, 11 months ago

In 13d4f48/git:

Revert #5648 fix
Causing regression failures on PG16 and PG17
References #5648 and #5650

comment:12 by Regina Obe <lr@…>, 10 months ago

In 66b10e5/git:

Remove from NEWS #5648. References #5648 since we reverted.

Note: See TracTickets for help on using tickets.