search
HomeBackend DevelopmentGolangAge Go driver error on Windows: function age_prepare_cypher(unknown, unknown) does not exist

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

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

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

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

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
This article is reproduced at:stackoverflow. If there is any infringement, please contact admin@php.cn delete
Golang vs. Python: The Pros and ConsGolang vs. Python: The Pros and ConsApr 21, 2025 am 12:17 AM

Golangisidealforbuildingscalablesystemsduetoitsefficiencyandconcurrency,whilePythonexcelsinquickscriptinganddataanalysisduetoitssimplicityandvastecosystem.Golang'sdesignencouragesclean,readablecodeanditsgoroutinesenableefficientconcurrentoperations,t

Golang and C  : Concurrency vs. Raw SpeedGolang and C : Concurrency vs. Raw SpeedApr 21, 2025 am 12:16 AM

Golang is better than C in concurrency, while C is better than Golang in raw speed. 1) Golang achieves efficient concurrency through goroutine and channel, which is suitable for handling a large number of concurrent tasks. 2)C Through compiler optimization and standard library, it provides high performance close to hardware, suitable for applications that require extreme optimization.

Why Use Golang? Benefits and Advantages ExplainedWhy Use Golang? Benefits and Advantages ExplainedApr 21, 2025 am 12:15 AM

Reasons for choosing Golang include: 1) high concurrency performance, 2) static type system, 3) garbage collection mechanism, 4) rich standard libraries and ecosystems, which make it an ideal choice for developing efficient and reliable software.

Golang vs. C  : Performance and Speed ComparisonGolang vs. C : Performance and Speed ComparisonApr 21, 2025 am 12:13 AM

Golang is suitable for rapid development and concurrent scenarios, and C is suitable for scenarios where extreme performance and low-level control are required. 1) Golang improves performance through garbage collection and concurrency mechanisms, and is suitable for high-concurrency Web service development. 2) C achieves the ultimate performance through manual memory management and compiler optimization, and is suitable for embedded system development.

Is Golang Faster Than C  ? Exploring the LimitsIs Golang Faster Than C ? Exploring the LimitsApr 20, 2025 am 12:19 AM

Golang performs better in compilation time and concurrent processing, while C has more advantages in running speed and memory management. 1.Golang has fast compilation speed and is suitable for rapid development. 2.C runs fast and is suitable for performance-critical applications. 3. Golang is simple and efficient in concurrent processing, suitable for concurrent programming. 4.C Manual memory management provides higher performance, but increases development complexity.

Golang: From Web Services to System ProgrammingGolang: From Web Services to System ProgrammingApr 20, 2025 am 12:18 AM

Golang's application in web services and system programming is mainly reflected in its simplicity, efficiency and concurrency. 1) In web services, Golang supports the creation of high-performance web applications and APIs through powerful HTTP libraries and concurrent processing capabilities. 2) In system programming, Golang uses features close to hardware and compatibility with C language to be suitable for operating system development and embedded systems.

Golang vs. C  : Benchmarks and Real-World PerformanceGolang vs. C : Benchmarks and Real-World PerformanceApr 20, 2025 am 12:18 AM

Golang and C have their own advantages and disadvantages in performance comparison: 1. Golang is suitable for high concurrency and rapid development, but garbage collection may affect performance; 2.C provides higher performance and hardware control, but has high development complexity. When making a choice, you need to consider project requirements and team skills in a comprehensive way.

Golang vs. Python: A Comparative AnalysisGolang vs. Python: A Comparative AnalysisApr 20, 2025 am 12:17 AM

Golang is suitable for high-performance and concurrent programming scenarios, while Python is suitable for rapid development and data processing. 1.Golang emphasizes simplicity and efficiency, and is suitable for back-end services and microservices. 2. Python is known for its concise syntax and rich libraries, suitable for data science and machine learning.

See all articles

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

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version