= 3.1 with SFCGAL using ALTER EXTENSION postgis_sfcgal UPDATE; or SELECT postgis_extensions_upgrade();. However if you are using pg_upgrade, you might get errors like postgis-3 does not contain function postgis_sfcgal_version() (which is part of the postgis_sfcgal extension). The three main reasons for this break were: We wanted postgis-3 library to have the same exposed functions regardless if you are compiling with SFCGAL or not. This change was planned in PostGIS 3.0, but only the backend switching plumbing was removed and not the complete detachment. It makes it possible for packagers to offer postgis_sfcgal (perhaps as a separate package), without requiring other users who just want postgis to have to have boost and CGAL. In the past postgis_sfcgal and postgis extensions were hooked together at the hip in the same underlying library, because their were a few functions overlapping in name such as ST_3DIntersects and ST_Intersects. Trying to explain to people how this whole thing worked, to switch the backend to sfcgal if they wanted extended 3D functionality, not to mention the added annoyance GUC backend of notices during upgrade was more of a pain than it was worth. So moving forward, we will not be reusing function names between the two extensions, and will have only non-overlapping function names. "> 将 postgis_sfcgal 升级到 3.1 或更高版本 | PostGIS - PostGIS 空间数据库 = 3.1 with SFCGAL using ALTER EXTENSION postgis_sfcgal UPDATE; or SELECT postgis_extensions_upgrade();. However if you are using pg_upgrade, you might get errors like postgis-3 does not contain function postgis_sfcgal_version() (which is part of the postgis_sfcgal extension). The three main reasons for this break were: We wanted postgis-3 library to have the same exposed functions regardless if you are compiling with SFCGAL or not. This change was planned in PostGIS 3.0, but only the backend switching plumbing was removed and not the complete detachment. It makes it possible for packagers to offer postgis_sfcgal (perhaps as a separate package), without requiring other users who just want postgis to have to have boost and CGAL. In the past postgis_sfcgal and postgis extensions were hooked together at the hip in the same underlying library, because their were a few functions overlapping in name such as ST_3DIntersects and ST_Intersects. Trying to explain to people how this whole thing worked, to switch the backend to sfcgal if they wanted extended 3D functionality, not to mention the added annoyance GUC backend of notices during upgrade was more of a pain than it was worth. So moving forward, we will not be reusing function names between the two extensions, and will have only non-overlapping function names. "> = 3.1 with SFCGAL using ALTER EXTENSION postgis_sfcgal UPDATE; or SELECT postgis_extensions_upgrade();. However if you are using pg_upgrade, you might get errors like postgis-3 does not contain function postgis_sfcgal_version() (which is part of the postgis_sfcgal extension). The three main reasons for this break were: We wanted postgis-3 library to have the same exposed functions regardless if you are compiling with SFCGAL or not. This change was planned in PostGIS 3.0, but only the backend switching plumbing was removed and not the complete detachment. It makes it possible for packagers to offer postgis_sfcgal (perhaps as a separate package), without requiring other users who just want postgis to have to have boost and CGAL. In the past postgis_sfcgal and postgis extensions were hooked together at the hip in the same underlying library, because their were a few functions overlapping in name such as ST_3DIntersects and ST_Intersects. Trying to explain to people how this whole thing worked, to switch the backend to sfcgal if they wanted extended 3D functionality, not to mention the added annoyance GUC backend of notices during upgrade was more of a pain than it was worth. So moving forward, we will not be reusing function names between the two extensions, and will have only non-overlapping function names. ">
PostGIS
切换深色/浅色/自动模式 - PostGIS 空间数据库 切换深色/浅色/自动模式 - PostGIS 空间数据库 切换深色/浅色/自动模式 - PostGIS 空间数据库 返回主页 - PostGIS 空间数据库

将 postgis_sfcgal 升级到 3.1 或更高版本

从 PostGIS 3.1 开始,PostGIS sfcgal 支持库不再是 postgis 核心库的一部分,而是分离到一个新库 postgis_sfcgal-3 中。

对于使用 ALTER EXTENSION postgis_sfcgal UPDATE;SELECT postgis_extensions_upgrade(); 从编译了 SFCGAL 的 PostGIS < 3.1 进行常规软升级到编译了 SFCGAL 的 PostGIS >= 3.1 的用户来说,此更改不是问题。但是,如果你正在使用 pg_upgrade,你可能会收到错误,例如 postgis-3 不包含函数 postgis_sfcgal_version()(这是 postgis_sfcgal 扩展的一部分)。

导致此中断的三个主要原因是

  • 我们希望 postgis-3 库具有相同的公开函数,无论你是否使用 SFCGAL 进行编译。此更改在 PostGIS 3.0 中已计划,但仅删除了后端切换管道,而不是完全分离。

  • 它使打包者能够提供 postgis_sfcgal(可能作为单独的包),而不需要其他仅需要 postgis 的用户拥有 boostCGAL

  • 过去,postgis_sfcgalpostgis 扩展在同一底层库中紧密相连,因为它们有一些重叠的函数名称,例如 ST_3DIntersectsST_Intersects。试图向人们解释整个工作原理,如果他们想要扩展的 3D 功能,就需要将后端切换到 sfcgal,更不用说升级期间的通知中增加了 GUC 后端 的烦恼,这比它本身带来的麻烦还要多。因此,展望未来,我们不会在两个扩展之间重复使用函数名称,并且只会使用不重叠的函数名称。

选项 1

使用 pg_upgrade 升级 PostGIS < 3.1 postgis_sfcgal 时最简单的修复方法是在运行 pg_upgrade 之前先删除 postgis_sfcgal 扩展。

这可以在不丢失数据的情况下完成,因为 postgis_sfcgal 扩展仅包含函数,而不包含数据类型。在旧集群中使用以下命令删除它之后

在尝试 pg_upgrade 之前在旧集群中

-- this step only needed for PostGIS < 3.1.0
DROP EXTENSION postgis_sfcgal;

如果你有视图、SQL 函数或绑定到 postgis_sfcgal 函数的约束,则上述 DROP EXTENSION 将失败。在这些情况下,你可以在 pg_upgrade 之前删除这些依赖项,并确保你有要重新创建的代码。或者,你可以执行选项 2

在旧集群中删除扩展后,你可以运行 pg_upgrade

pg_upgrade 之后,在新的集群中,重新添加它。

CREATE EXTENSION postgis_sfcgal;

如果你没有在与 postgis 扩展相同的架构中安装,则创建扩展应该会出错。如果你收到错误,请明确指定你安装 postgis 的架构

CREATE EXTENSION postgis_sfcgal SCHEMA postgis;

选项 2

在旧集群上,确保你已安装 3.1 或更高版本的 postgis 二进制文件,然后执行

ALTER EXTENSION postgis UPDATE;
SELECT postgis_extensions_upgrade();

然后像往常一样运行 pg_upgrade