[PostGIS] #5648: postgis_raster upgrade fails on PG16

PostGIS trac at osgeo.org
Tue Dec 19 08:17:34 PST 2023


#5648: postgis_raster upgrade fails on PG16
-----------------------+---------------------------
  Reporter:  rdunklau  |      Owner:  robe
      Type:  defect    |     Status:  new
  Priority:  medium    |  Milestone:  PostGIS 3.4.2
 Component:  raster    |    Version:  3.4.x
Resolution:            |   Keywords:
-----------------------+---------------------------
Description changed by rdunklau:

Old description:

> 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
>
> }}}

New description:

 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

--
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5648#comment:2>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list