Skip to content

If password is "" in dsn, I get a error options after parseOpts #879

@YoungWing

Description

@YoungWing

test code like this:

        o := make(map[string]string)
	dsn := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable",
		"localhost",
		5432,
		"test",
		"",
		"testDB",
	)
	parseOpts(dsn, o)
	fmt.Println(o)

output:

map[host:localhost password:dbname=testDB port:5432 sslmode:disable user:test]

in this map, we can see the passwd value is that "dbname=testDB" rather than ""

In this case,it is a wrong dsn parser?

Or when my passwd is null, I can only put passwd end of dsn,like this:

dsn := fmt.Sprintf("host=%s port=%d user=%s dbname=%s sslmode=disable password=%s",
		"localhost",
		5432,
		"test",
		"testDB",
		"",
	) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions