Maison > développement back-end > Golang > Erreur du pilote Age Go sous Windows : la fonction age_prepare_cypher (inconnu, inconnu) n'existe pas

Erreur du pilote Age Go sous Windows : la fonction age_prepare_cypher (inconnu, inconnu) n'existe pas

PHPz
Libérer: 2024-02-09 08:21:20
avant
1117 Les gens l'ont consulté

Windows 上的 Age Go 驱动程序错误:函数age_prepare_cypher(未知,未知)不存在

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 API
SELECT * FROM age_prepare_cypher($1, $2); testGraph CREATE (n:Person {name: '%s'})
panic: pq: function age_prepare_cypher(unknown, unknown) does not exist

goroutine 1 [running]:
main.doWithAgeWrapper({0x1004e94?, 0xc00000a018?}, {0xff0efb?, 0x1?})
        C:/Users/ahmar/Desktop/GOlang drivers/samples/age_wrapper_sample.go:43 +0xcb4
main.main()
        C:/Users/ahmar/Desktop/GOlang drivers/samples/main.go:41 +0x77
exit status 2
Copier après la connexion

当我直接在 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
Copier après la connexion

然后在提交 42f94e7f36dc084b74ec335536a18173c6fca4cd 上运行示例,无需任何更改:

$ go run main.go age_wrapper_sample.go sql_api_sample.go
# do cypher query with sql api
select * 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
Copier après la connexion

您会看到 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)
Copier après la connexion

如果情况并非如此,请描述重现该问题的确切步骤。谢谢!

Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!

Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal