File permissions error reported as "out of memory"
When trying to create a database in a location that is not writable, this library reports "out of memory" instead of anything related to file permissions.
Example program:
package main
import (
"database/sql"
"log"
_ "modernc.org/sqlite"
)
func main() {
// Note: /sys is a read-only filesystem.
// Substitute with any path not writable by the user,
// e.g. /sbin
db, err := sql.Open("sqlite", "file:/sys/repro.db")
if err != nil {
log.Fatalf("sql.Open: %v", err)
}
schema := "PRAGMA journal_mode=WAL;"
if _, err := db.Exec(schema); err != nil {
log.Fatalf("db.Exec(%q): %v", schema, err)
}
}
Actual behaviour
Logs the message
2025/09/29 13:25:54 db.Exec("PRAGMA journal_mode=WAL;"): unable to open database file: out of memory (14)
Expected behaviour
The logged error should say something about the filesystem permissions.
Other information
modernc.org/sqlite v1.39.0 Go 1.25.1 Reproduced on macOS 15.7 and Debian 13