age icon indicating copy to clipboard operation
age copied to clipboard

Support: PostgreSQL 18

Open leonardo-anchino opened this issue 5 months ago • 6 comments

Hey! 👋 Just wondering if there are any plans to support PostgreSQL 18. It was recently released and I’m curious if compatibility is on the roadmap or if there’s anything we should keep in mind when upgrading.

Thanks a lot! 🙌

leonardo-anchino avatar Oct 02 '25 13:10 leonardo-anchino

Yes.

The fix PR is there. I had gotten some review comments on #2165 . I had been unable to work on them until today.

Will update once it is in release.

sanchayanghosh avatar Oct 09 '25 12:10 sanchayanghosh

PostgreSQL 18 + Apache AGE 兼容性修复总结

问题概述 Apache AGE 目前(截至 2025 年 11 月)尚未正式支持 PostgreSQL 18,编译时会遇到 API 不兼容的问题。

主要问题 编译错误显示 PostgreSQL 18 中的 ExecInitExtraTupleSlot 函数签名发生了变化。具体错误:

1 error: call to undeclared function 'ExecInitExtraTupleSlot'

修复方案

  1. 识别问题函数 找到三个文件中使用 ExecInitExtraTupleSlot 的位置:
  • src/backend/catalog/ag_label.c (第 313 行)
  • src/backend/executor/cypher_delete.c (第 495 行)
  • src/backend/executor/cypher_merge.c (第 167 行)
  1. 实施兼容性修复 使用条件编译来处理不同版本的 PostgreSQL:

ag_label.c 中:

1 #if PG_VERSION_NUM >= 180000 2 slot = MakeSingleTupleTableSlot(RelationGetDescr(resultRelInfo->ri_RelationDesc), &TTSOpsHeapTuple); 3 #else 4 slot = ExecInitExtraTupleSlot( 5 estate, RelationGetDescr(resultRelInfo->ri_RelationDesc), 6 &TTSOpsHeapTuple); 7 #endif

cypher_delete.c 中:

1 #if PG_VERSION_NUM >= 180000 2 slot = MakeSingleTupleTableSlot(RelationGetDescr(resultRelInfo->ri_RelationDesc), &TTSOpsHeapTuple); 3 #else 4 slot = ExecInitExtraTupleSlot( 5 estate, RelationGetDescr(resultRelInfo->ri_RelationDesc), 6 &TTSOpsHeapTuple); 7 #endif

cypher_merge.c 中:

1 #if PG_VERSION_NUM >= 180000 2 cypher_node->elemTupleSlot = MakeSingleTupleTableSlot(RelationGetDescr(cypher_node->resultRelInfo->ri_RelationDesc), &TTSOpsHeapTuple); 3 #else 4 cypher_node->elemTupleSlot = ExecInitExtraTupleSlot( 5 estate, 6 RelationGetDescr(cypher_node->resultRelInfo->ri_RelationDesc), 7 &TTSOpsHeapTuple); 8 #endif

修复说明

  • PostgreSQL 18 及更高版本:使用 MakeSingleTupleTableSlot 函数
  • PostgreSQL 17 及更早版本:使用原有的 ExecInitExtraTupleSlot 函数(带 3 个参数)
  • 通过 PG_VERSION_NUM >= 180000 宏进行版本判断

后续问题 修复初始问题后,还发现了 PostgreSQL 18 中更多的 API 变更,涉及:

  • ExecInitNode, ExecAssignExprContext, ExecInitScanTupleSlot
  • ExecGetResultType, ExecAssignProjectionInfo, InitResultRelInfo
  • ExecOpenIndices, ExecCloseIndices, ExecProject, ExecProcNode

当前状态

  • ✅ 成功修复了初始的 ExecInitExtraTupleSlot 问题
  • ✅ 实现了条件编译兼容性
  • ❌ 发现更多需要修复的 API 变更(需要更彻底的代码适配)

结论 这个修复可以作为 Apache AGE 官方支持 PostgreSQL 18 的起点

walker83 avatar Nov 16 '25 02:11 walker83

The support is now available in master. Another PR fixed the regression issues.

sanchayanghosh avatar Nov 30 '25 17:11 sanchayanghosh

@sanchayanghosh @leonardo-anchino The fix isn't in the master branch, it is in the PG18 branch :) The master branch will be advanced to PostgreSQL 18 after all of the releases are done and we're sure that PG18 is ready for a release.

jrgemignani avatar Dec 01 '25 16:12 jrgemignani

Hi @jrgemignani! I'm excited about the upcoming PostgreSQL 18 support.

Is there an estimated release date for the Apache AGE version that will support PostgreSQL 18?

kakao-edgar-p avatar Dec 04 '25 05:12 kakao-edgar-p

Hi @jrgemignani! I'm excited about the upcoming PostgreSQL 18 support.

Is there an estimated release date for the Apache AGE version that will support PostgreSQL 18?

@kakao-edgar-p Time permitting, early January, possibly.

jrgemignani avatar Dec 04 '25 18:12 jrgemignani