php小编子墨近期收到读者反馈,在Windows系统上运行Age Go时遇到了驱动程序错误:“函数age_prepare_cypher(未知,未知)不存在”。这个错误会导致游戏无法正常启动,给玩家带来了很多困扰。在本文中,我们将帮助大家解决这个问题,并提供一些可能的解决方案,让大家能够顺利畅玩Age Go。
问题内容
我正在尝试使用 apache age 的 golang 驱动程序在 windows 上运行密码查询。对于 postgres 服务器,我使用 apache-age docker 映像。
运行示例时,出现以下错误:
ahmar> go run main.go age_wrapper_sample.go sql_api_sample.go # Do cypher query with Age APISELECT * FROM age_prepare_cypher($1, $2); testGraph CREATE (n:Person {name: '%s'})panic: pq: function age_prepare_cypher(unknown, unknown) does not existgoroutine 1 [running]:main.doWithAgeWrapper({0x1004e94?, 0xc00000a018?}, {0xff0efb?, 0x1?}) C:/Users/ahmar/Desktop/GOlang drivers/samples/age_wrapper_sample.go:43 +0xcb4main.main() C:/Users/ahmar/Desktop/GOlang drivers/samples/main.go:41 +0x77exit status 2
登录后复制
当我直接在 postgres 服务器上运行查询时,它们工作正常。另外,其他年龄命令(如 load ‘age’; 等)正在从驱动程序运行,但 execcypher() 函数不起作用。
当调用 age_prepare_cypher() 函数时,该错误似乎源自 execcypher() 中的 age.go 文件。
注意:我在 linux 上没有遇到此错误。在那里,使用 age go 驱动程序时查询工作正常,并且我得到了预期的输出。
解决方法
最近在此提交中添加了函数 age_prepare_cypher 。它没有添加到图像 apache/age:v1.1.0 中。因此,如果您在提交 42f94e7f36dc084b74ec335536a18173c6fca4cd 处运行示例并连接到镜像 apache/age:v1.1.0 ,你会得到错误 panic: pq: function age_prepare_cypher(unknown,unknown) 不存在。
我使用以下命令运行容器:
docker run --name age -p 5432:5432 -e postgres_user=postgres -e postgres_password=agens -e postgres_db=postgres -d apache/age:v1.1.0
登录后复制
然后在提交 42f94e7f36dc084b74ec335536a18173c6fca4cd 上运行示例,无需任何更改: p>
$ go run main.go age_wrapper_sample.go sql_api_sample.go# do cypher query with sql apiselect * from age_prepare_cypher($1, $2); testgraph create (n:person {name: '%s', weight:%f})panic: pq: function age_prepare_cypher(unknown, unknown) does not exist
登录后复制
您会看到 sql_api_sample 首先失败;在您的问题中,只有 age_wrapper_sample 失败。所以看来您已经修改了源代码,并且两个示例连接到了不同的数据库。请仔细检查失败示例连接的是哪个数据库,并查看该函数是否在该数据库中定义。您可以使用 df 检查函数是否存在。这是找不到函数时的输出:
postgres=# df ag_catalog.age_prepare_cypher List of functions Schema | Name | Result data type | Argument data types | Type --------+------+------------------+---------------------+------(0 rows)
登录后复制
如果情况并非如此,请描述重现该问题的确切步骤。谢谢!
以上就是Windows 上的 Age Go 驱动程序错误:函数age_prepare_cypher(未知,未知)不存在的详细内容,更多请关注【创想鸟】其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。
发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2484833.html