Table of Contents
问题内容
解决方法
Home Backend Development Golang Age Go driver error on Windows: function age_prepare_cypher(unknown, unknown) does not exist

Age Go driver error on Windows: function age_prepare_cypher(unknown, unknown) does not exist

Feb 09, 2024 am 08:21 AM

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
Copy after login

当我直接在 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
Copy after login

然后在提交 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
Copy after login

您会看到 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)
Copy after login

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

The above is the detailed content of Age Go driver error on Windows: function age_prepare_cypher(unknown, unknown) does not exist. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What are the vulnerabilities of Debian OpenSSL What are the vulnerabilities of Debian OpenSSL Apr 02, 2025 am 07:30 AM

OpenSSL, as an open source library widely used in secure communications, provides encryption algorithms, keys and certificate management functions. However, there are some known security vulnerabilities in its historical version, some of which are extremely harmful. This article will focus on common vulnerabilities and response measures for OpenSSL in Debian systems. DebianOpenSSL known vulnerabilities: OpenSSL has experienced several serious vulnerabilities, such as: Heart Bleeding Vulnerability (CVE-2014-0160): This vulnerability affects OpenSSL 1.0.1 to 1.0.1f and 1.0.2 to 1.0.2 beta versions. An attacker can use this vulnerability to unauthorized read sensitive information on the server, including encryption keys, etc.

How do you write unit tests in Go? How do you write unit tests in Go? Mar 21, 2025 pm 06:34 PM

The article discusses writing unit tests in Go, covering best practices, mocking techniques, and tools for efficient test management.

How do you use the pprof tool to analyze Go performance? How do you use the pprof tool to analyze Go performance? Mar 21, 2025 pm 06:37 PM

The article explains how to use the pprof tool for analyzing Go performance, including enabling profiling, collecting data, and identifying common bottlenecks like CPU and memory issues.Character count: 159

What is the problem with Queue thread in Go's crawler Colly? What is the problem with Queue thread in Go's crawler Colly? Apr 02, 2025 pm 02:09 PM

Queue threading problem in Go crawler Colly explores the problem of using the Colly crawler library in Go language, developers often encounter problems with threads and request queues. �...

What libraries are used for floating point number operations in Go? What libraries are used for floating point number operations in Go? Apr 02, 2025 pm 02:06 PM

The library used for floating-point number operation in Go language introduces how to ensure the accuracy is...

PostgreSQL monitoring method under Debian PostgreSQL monitoring method under Debian Apr 02, 2025 am 07:27 AM

This article introduces a variety of methods and tools to monitor PostgreSQL databases under the Debian system, helping you to fully grasp database performance monitoring. 1. Use PostgreSQL to build-in monitoring view PostgreSQL itself provides multiple views for monitoring database activities: pg_stat_activity: displays database activities in real time, including connections, queries, transactions and other information. pg_stat_replication: Monitors replication status, especially suitable for stream replication clusters. pg_stat_database: Provides database statistics, such as database size, transaction commit/rollback times and other key indicators. 2. Use log analysis tool pgBadg

Transforming from front-end to back-end development, is it more promising to learn Java or Golang? Transforming from front-end to back-end development, is it more promising to learn Java or Golang? Apr 02, 2025 am 09:12 AM

Backend learning path: The exploration journey from front-end to back-end As a back-end beginner who transforms from front-end development, you already have the foundation of nodejs,...

How to solve the user_id type conversion problem when using Redis Stream to implement message queues in Go language? How to solve the user_id type conversion problem when using Redis Stream to implement message queues in Go language? Apr 02, 2025 pm 04:54 PM

The problem of using RedisStream to implement message queues in Go language is using Go language and Redis...

See all articles