Skip to content

Commit

Permalink
Merge pull request #279 from supabase/bo/fix/like-qual
Browse files Browse the repository at this point in the history
fix: deparse LIKE operator in qual
  • Loading branch information
burmecia authored May 24, 2024
2 parents a85935b + 81c5dd8 commit 3d0d518
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions supabase-wrappers/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ impl Qual {
}
_ => format!("{} {} {}", self.field, self.operator, cell),
},
"~~" => format!("{} like {}", self.field, cell),
"!~~" => format!("{} not like {}", self.field, cell),
_ => format!("{} {} {}", self.field, self.operator, cell),
},
Value::Array(_) => unreachable!(),
Expand Down
22 changes: 22 additions & 0 deletions wrappers/src/fdw/mssql_fdw/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,28 @@ mod tests {
.collect::<Vec<_>>();
assert_eq!(results, vec!["bar", "baz"]);

let results = c
.select(
"SELECT name FROM mssql_users WHERE name like 'ba%' ORDER BY id",
None,
None,
)
.unwrap()
.filter_map(|r| r.get_by_name::<&str, _>("name").unwrap())
.collect::<Vec<_>>();
assert_eq!(results, vec!["bar", "baz"]);

let results = c
.select(
"SELECT name FROM mssql_users WHERE name not like 'ba%'",
None,
None,
)
.unwrap()
.filter_map(|r| r.get_by_name::<&str, _>("name").unwrap())
.collect::<Vec<_>>();
assert_eq!(results, vec!["foo"]);

let results = c
.select(
"SELECT name FROM mssql_users_cust_sql ORDER BY id",
Expand Down

0 comments on commit 3d0d518

Please sign in to comment.