Skip to content

Commit

Permalink
Default to using username when database isn't present on startup (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
zainkabani authored Nov 17, 2022
1 parent ab85000 commit b7e70b8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,17 +359,17 @@ where
let stats = get_reporter();
let parameters = parse_startup(bytes.clone())?;

// These two parameters are mandatory by the protocol.
let pool_name = match parameters.get("database") {
Some(db) => db,
None => return Err(Error::ClientError),
};

// This parameter is mandatory by the protocol.
let username = match parameters.get("user") {
Some(user) => user,
None => return Err(Error::ClientError),
};

let pool_name = match parameters.get("database") {
Some(db) => db,
None => username,
};

let application_name = match parameters.get("application_name") {
Some(application_name) => application_name,
None => "pgcat",
Expand Down

0 comments on commit b7e70b8

Please sign in to comment.