You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PostgreSQL v12环境下AGE回归测试失败问题咨询

macOS 12.6.3 下 AGE_PG12.1.0_ALPHA 回归测试失败问题

我在 macOS 12.6.3 系统上,使用 PostgreSQL REL_12_STABLE 和 AGE_PG12.1.0_ALPHA 分支安装 AGE,执行 installcheck 回归测试后有2个测试失败。已知字符串比较返回值差异是 macOS 导致的,但不确定这两个失败是否严重,以及修复方法。

终端执行记录

➜  age git:(AGE_PG12.1.0_ALPHA) make PG_CONFIG=/usr/local/pgsql-12/bin/pg_config installcheck
/usr/local/pgsql-12/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=./ --bindir='/usr/local/pgsql-12/bin'    --load-extension=age --inputdir=.//regress --outputdir=.//regress --temp-instance=.//regress/instance --port=61958 --encoding=UTF-8 --dbname=contrib_regression scan graphid agtype catalog cypher expr cypher_create cypher_match cypher_unwind cypher_set cypher_remove cypher_delete cypher_with cypher_vle cypher_union cypher_merge age_load index drop
============== creating temporary instance            ==============
============== initializing database system           ==============
============== starting postmaster                    ==============
running on port 61958 with PID 69718
============== creating database "contrib_regression" ==============
CREATE DATABASE
ALTER DATABASE
============== installing age                         ==============
CREATE EXTENSION
============== running regression test queries        ==============
test scan                         ... ok          636 ms
test graphid                      ... ok           37 ms
test agtype                       ... FAILED      140 ms
test catalog                      ... FAILED      179 ms
test cypher                       ... ok           55 ms
test expr                         ... ok          890 ms
test cypher_create                ... ok          223 ms
test cypher_match                 ... ok          535 ms
test cypher_unwind                ... ok           63 ms
test cypher_set                   ... ok          171 ms
test cypher_remove                ... ok          187 ms
test cypher_delete                ... ok          174 ms
test cypher_with                  ... ok           59 ms
test cypher_vle                   ... ok         1574 ms
test cypher_union                 ... ok           80 ms
test cypher_merge                 ... ok          191 ms
test age_load                     ... ok         2858 ms
test index                        ... ok          151 ms
test drop                         ... ok          357 ms
============== shutting down postmaster               ==============

=======================
 2 of 19 tests failed. 
=======================

The differences that caused some tests to fail can be viewed in the
file "/Users/kenwoon/Desktop/age/./regress/regression.diffs".  A copy of the test summary that you see
above is saved in the file "/Users/kenwoon/Desktop/age/./regress/regression.out".

make: *** [installcheck] Error 1

测试差异文件内容

diff -U3 /Users/kenwoon/Desktop/age/./regress/expected/agtype.out /Users/kenwoon/Desktop/age/./regress/results/agtype.out
--- /Users/kenwoon/Desktop/age/./regress/expected/agtype.out    2023-02-23 12:12:51.000000000 -0800
+++ /Users/kenwoon/Desktop/age/./regress/results/agtype.out 2023-02-23 12:13:28.000000000 -0800
@@ -2886,7 +2886,7 @@
 SELECT agtype_btree_cmp('"string"'::agtype, '"string "'::agtype);
  agtype_btree_cmp 
 ------------------
-               -1
+              -32
 (1 row)

 SELECT agtype_btree_cmp(NULL, NULL);
diff -U3 /Users/kenwoon/age/./regress/expected/catalog.out /Users/kenwoon/Desktop/age/./regress/results/catalog.out
--- /Users/kenwoon/Desktop/age/./regress/expected/catalog.out   2023-02-23 12:12:51.000000000 -0800
+++ /Users/kenwoon/Desktop/age/./regress/results/catalog.out    2023-02-23 12:13:28.000000000 -0800
@@ -61,10 +61,10 @@
 drop cascades to table g._ag_label_vertex
 drop cascades to table g._ag_label_edge
 drop cascades to table g.v
-ERROR:  table "v" is for label "v"
+ERROR:  table "v" is for label ""
 -- DROP TABLE ... should fail
 DROP TABLE g.v;
-ERROR:  table "v" is for label "v"
+ERROR:  table "v" is for label ""
 -- should fail (cascade = false)
 SELECT drop_graph('g');
 ERROR:  cannot drop schema g because other objects depend on it

测试失败分析与修复方案

1. agtype 测试失败

这是 macOS 与 Linux 的 strcmp 函数行为差异导致:

  • Linux 下 strcmp 仅返回 -1/0/1 表示比较结果
  • macOS 下 strcmp 返回两个字符串首个不同字符的 ASCII 差值(此处空格 ASCII 为32,故返回 -32)

严重性:不严重。排序逻辑核心是判断返回值正负,具体数值不影响 AGtype 的索引、比较功能,只是测试用例硬编码了预期值。

修复方法:
修改 regress/expected/agtype.out 中对应测试行,将预期值从 -1 改为 -32;或者直接忽略该失败,不影响实际使用。

2. catalog 测试失败

这是 macOS 系统函数行为差异导致,获取表关联标签名时返回空字符串。

严重性:需要修复。错误提示信息不准确,极端情况可能影响依赖标签名的逻辑。

修复方法:

  • 检查 AGE 的 catalog 相关代码,定位抛出错误提示的函数(如 DROP TABLE 拦截逻辑)
  • 调整系统表查询或字符串处理逻辑,确保 macOS 下能正确读取标签名
  • 切换到 AGE 后续稳定版本,这类平台兼容性问题通常会被修复

内容的提问来源于stack exchange,提问作者Ken W.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 23:18:33