Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgres: fix postgres address parse #4731

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/object/object_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ func TestPG(t *testing.T) { //skip mutate

}
func TestPGWithSearchPath(t *testing.T) { //skip mutate
_, err := newSQLStore("postgres", "localhost:5432/test?sslmode=disable&search_path=juicefs,public", "", "")
_, err := newSQLStore("postgres", "127.0.0.1:5432/test?sslmode=disable&search_path=juicefs,public", "", "")
if !strings.Contains(err.Error(), "currently, only one schema is supported in search_path") {
t.Fatalf("TestPGWithSearchPath error: %s", err)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/object/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ func newSQLStore(driver, addr, user, password string) (ObjectStorage, error) {
uri = "postgres://" + uri
driver = "pgx"

parse, err := url.Parse(addr)
parse, err := url.Parse(uri)
if err != nil {
return nil, fmt.Errorf("parse url %s failed: %s", addr, err)
return nil, fmt.Errorf("parse url %s failed: %s", uri, err)
}
searchPath = parse.Query().Get("search_path")
if searchPath != "" {
Expand Down
Loading