{"record":{"id":"98c13e855a39d0ea","repo":"juicedata/juicefs","slug":"currently-only-one-schema-is-supported-in-search-98c13e","errorCode":null,"errorMessage":"currently, only one schema is supported in search_path","messagePattern":"currently, only one schema is supported in search_path","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/object/sql.go","lineNumber":180,"sourceCode":"func newSQLStore(driver, addr, user, password string) (ObjectStorage, error) {\n\tvar err error\n\turi := addr\n\tif user != \"\" {\n\t\turi = user + \":\" + password + \"@\" + addr\n\t}\n\tvar searchPath string\n\tif driver == \"postgres\" {\n\t\turi = \"postgres://\" + uri\n\t\tdriver = \"pgx\"\n\n\t\tparse, err := url.Parse(uri)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"parse url %s failed: %s\", uri, 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\tengine, err := xorm.NewEngine(driver, uri)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"open %s: %s\", uri, err)\n\t}\n\tswitch logger.Level { // make xorm less verbose\n\tcase logrus.TraceLevel:\n\t\tengine.SetLogLevel(log.LOG_DEBUG)\n\tcase logrus.DebugLevel:\n\t\tengine.SetLogLevel(log.LOG_INFO)\n\tcase logrus.InfoLevel, logrus.WarnLevel:\n\t\tengine.SetLogLevel(log.LOG_WARNING)\n\tcase logrus.ErrorLevel:\n\t\tengine.SetLogLevel(log.LOG_ERR)\n\tdefault:\n\t\tengine.SetLogLevel(log.LOG_OFF)","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/object/sql.go#L162-L198","documentation":"When a postgres metadata URL specifies a search_path query parameter, newSQLStore enforces that only a single schema is supported. Passing a comma-separated list (e.g. search_path=a,b) is rejected at construction time because the driver sets exactly one xorm schema.","triggerScenarios":"Using a JuiceFS metadata URL like 'postgres://user:pw@host/db?search_path=schema1,schema2' — any search_path value containing a comma triggers this error.","commonSituations":"Copying a search_path from a psql/postgres client config that defaults to \"$user\",public (note the comma) and pasting it into the JuiceFS metadata URL.","solutions":["Use exactly one schema in the URL: ?search_path=myschema.","Pre-create the target schema in the database and grant the user USAGE/CREATE on it.","If you need multiple schemas, run separate JuiceFS volumes, one per schema."],"exampleFix":"// before\nmeta := \"postgres://user:pw@host/db?search_path=public,jfs\"\n// after\nmeta := \"postgres://user:pw@host/db?search_path=jfs\"","handlingStrategy":"validation","validationCode":"if sp := parse.Query().Get(\"search_path\"); strings.Contains(sp, \",\") {\n    return fmt.Errorf(\"search_path must contain exactly one schema, got %q\", sp)\n}","typeGuard":null,"tryCatchPattern":"if err != nil && err.Error() == \"currently, only one schema is supported in search_path\" {\n    // reduce search_path to a single schema in the metadata URL\n}","preventionTips":["Never copy multi-schema search_path values (e.g. \"$user\",public) into the metadata URL.","Pre-create the single target schema with proper grants.","Document the single-schema constraint in deployment configs."],"tags":["sql","postgres","schema","config"],"backgroundTag":"invalid-argument-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"}