marcboeker / go-duckdb

go-duckdb provides a database/sql driver for the DuckDB database engine.
MIT License
646 stars 97 forks source link

Process Exits on Invalid PRAGMA with DuckDB Golang Binding #142

Closed szarnyasg closed 8 months ago

szarnyasg commented 8 months ago

Originally raised by @amigooy in https://github.com/duckdb/duckdb/issues/10127

What happens?

I'm experiencing an issue with the DuckDB Golang binding (go-duckdb v1.5.6) where executing a PRAGMA statement with a non-existent function causes the process to exit unexpectedly.

To Reproduce

package main

import (
    "database/sql"
    _ "github.com/marcboeker/go-duckdb"
)

func main() {
    db, _ := sql.Open("duckdb", "")
    _, _ = db.Query(`PRAGMA something`)
}

Outputs:

libc++abi.dylib: terminating with uncaught exception of type duckdb::CatalogException: Catalog Error: Pragma Function with name something does not exist!
Did you mean "show"?
SIGABRT: abort
PC=0x7fff20423462 m=0 sigcode=0
signal arrived during cgo execution

OS:

MacOS 11.2.3

DuckDB Version:

v0.9.2(source_id: 3c695d7)

DuckDB Client:

go-duckdb v1.5.6

Full Name:

Yang Ou

Affiliation:

Duozhuayu

Have you tried this on the latest main branch?

I have tested with a release build (and could not test with a main build)

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

marcboeker commented 8 months ago

Closing this as the problem lies in the C-API.