{"record":{"id":"c2b2cc25281102b1","repo":"cayleygraph/cayley","slug":"unsupported-sql-database-q","errorCode":null,"errorMessage":"unsupported sql database: %q","messagePattern":"unsupported sql database: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"graph/sql/quadstore.go","lineNumber":204,"sourceCode":"}\n\nvar nodeInsertColumns = [][]string{\n\t{\"value\"},\n\t{\"value_string\", \"iri\"},\n\t{\"value_string\", \"bnode\"},\n\t{\"value_string\"},\n\t{\"value_string\", \"datatype\"},\n\t{\"value_string\", \"language\"},\n\t{\"value_int\"},\n\t{\"value_bool\"},\n\t{\"value_float\"},\n\t{\"value_time\"},\n}\n\nfunc Init(typ string, addr string, options graph.Options) error {\n\tfl, ok := types[typ]\n\tif !ok {\n\t\treturn fmt.Errorf(\"unsupported sql database: %q\", typ)\n\t}\n\tconn, err := connect(addr, fl.Driver, options)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tnodesSQL := fl.nodesTable()\n\tquadsSQL := fl.quadsTable()\n\tindexes := fl.quadIndexes(options)\n\n\tif fl.NoSchemaChangesInTx {\n\t\t_, err = conn.Exec(nodesSQL)\n\t\tif err != nil {\n\t\t\terr = fl.Error(err)\n\t\t\tclog.Errorf(\"Cannot create nodes table: %v\", err)\n\t\t\treturn err\n\t\t}","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/cayleygraph/cayley/blob/81dcd7d73e45136bc0d01802a8ba4685d8a533eb/graph/sql/quadstore.go#L186-L222","documentation":"Init registers and opens a SQL-backed quadstore. The SQL flavor must be one of the keys in the package's `types` map (postgres, mysql, sqlite). If the `typ` string passed in doesn't match any registered flavor, the store refuses to initialize and returns this error before attempting any connection.","triggerScenarios":"Calling graph/sql.Init with a backend name not in the types map, e.g. Init(\"postgresql\", ...) when only \"postgres\" is registered, or a typo like \"sqllite\".","commonSituations":" Cayley config files where database: is set to a misspelled or renamed backend name; migrating from another triplestore whose driver names differ (e.g. \"cockroach\" vs \"postgres\"); upgrading versions where a flavor was removed.","solutions":["Check the spelling of the type argument against the supported list (postgres, mysql, sqlite)","Fix the database/type field in the Cayley config or command-line flag to a supported value","Inspect the types map in graph/sql/quadstore.go for the exact registered keys in your version","Register a custom flavor by importing a driver package (e.g. _ \"github.com/.../sql/postgres\") if it exists"],"exampleFix":"// before\nerr := sql.Init(\"postgresql\", addr, opts)\n// after\nerr := sql.Init(\"postgres\", addr, opts)","handlingStrategy":"validation","validationCode":"supported := []string{\"postgres\", \"mysql\", \"sqlite\"}\nfound := false\nfor _, s := range supported { if typ == s { found = true } }\nif !found { return fmt.Errorf(\"unsupported sql type %q; supported: %v\", typ, supported) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the database type string in one config constant, not duplicated strings","Validate config at startup before calling Init","Check the types map for your exact library version"],"tags":["database","sql","configuration"],"backgroundTag":"invalid-enum-value","analyzedSha":"81dcd7d73e45136bc0d01802a8ba4685d8a533eb","analyzedAt":"2026-09-06T06:14:12.358Z","contentChangedAt":"2026-09-06T06:14:12.358Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}