{"record":{"id":"674a09c9dc52058f","repo":"juicedata/juicefs","slug":"currently-only-one-schema-is-supported-in-search","errorCode":null,"errorMessage":"currently, only one schema is supported in search_path","messagePattern":"currently, only one schema is supported in search_path","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/sql.go","lineNumber":477,"sourceCode":"\n\tif encode := query.Encode(); encode != \"\" {\n\t\taddr = fmt.Sprintf(\"%s?%s\", baseUrl, encode)\n\t} else {\n\t\taddr = baseUrl\n\t}\n\n\tif driver == \"postgres\" {\n\t\taddr = driver + \"://\" + addr\n\t\tdriver = \"pgx\"\n\n\t\tparse, err := url.Parse(addr)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"parse url %s failed: %s\", addr, err)\n\t\t}\n\t\tsearchPath = parse.Query().Get(\"search_path\")\n\t\tif searchPath != \"\" {\n\t\t\tif len(strings.Split(searchPath, \",\")) > 1 {\n\t\t\t\treturn nil, fmt.Errorf(\"currently, only one schema is supported in search_path\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif driver == \"sqlite3\" {\n\t\tDirBatchNum[\"db\"] = 4096 // SQLITE_MAX_VARIABLE_NUMBER limit\n\t}\n\n\tvar engine *xorm.Engine\n\tif creator, ok := engineCreator[driver]; ok {\n\t\tengine, err = creator(addr)\n\t} else {\n\t\tengine, err = xorm.NewEngine(driver, addr)\n\t}\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to use data source %s: %s\", driver, err)\n\t}\n","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/sql.go#L459-L495","documentation":"JuiceFS's SQL metadata engine supports a `search_path` query parameter for PostgreSQL to select which schema holds the JuiceFS tables, but currently accepts only a single schema. If the URL's search_path contains multiple comma-separated schemas (valid for plain PostgreSQL clients), the client is rejected with this explicit error instead of silently choosing one.","triggerScenarios":"Formatting or mounting with a metadata URL like `postgres://user:pass@host/db?search_path=public,jfs` — a comma-separated multi-schema search_path — while creating the dbMeta client.","commonSituations":"Copying a PG connection string tuned for other tools that set a schema search order (`search_path=app,public`); inheriting a cluster-wide multi-schema default search_path; migrating volumes with both old and new schemas listed.","solutions":["Edit the metadata URL so search_path contains exactly one schema, e.g. `?search_path=jfs`.","If tables exist in several schemas, use a separate JuiceFS volume per schema.","Drop the extra schemas inherited from other tools from the JuiceFS URL only.","Check release notes for updated multi-schema support before assuming the limitation persists."],"exampleFix":"// before\n--meta 'postgres://user:pass@host:5432/db?search_path=public,jfs'\n// after\n--meta 'postgres://user:pass@host:5432/db?search_path=jfs'","handlingStrategy":"validation","validationCode":"sp := u.Query().Get(\"search_path\")\nif strings.Contains(sp, \",\") {\n    return errors.New(\"JuiceFS supports only a single schema in search_path\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set search_path to a single dedicated schema for JuiceFS tables.","Keep other tools' multi-schema search_path out of the JuiceFS URL.","Document the intended schema next to the mount configuration.","Check release notes for multi-schema support before relying on it."],"tags":["go","postgres","configuration","schema"],"backgroundTag":"unsupported-config-value","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}