Skip to content

Commit

Permalink
improve basic query (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-t-wang authored Jan 6, 2025
1 parent 7f3a664 commit 21c3e91
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/routes/api/v1/query_single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub async fn query_single(
) -> Result<Response, ErrorResponse> {
if let Some(name) = sqlx::query_as!(
Name,
"SELECT * FROM names WHERE username = $1 OR address = $1",
"SELECT * FROM names WHERE username = $1 UNION ALL SELECT * FROM names WHERE address = $1 AND username <> $1",
validate_address(&name_or_address)
)
.fetch_optional(&db.read_only)
Expand Down

0 comments on commit 21c3e91

Please sign in to comment.