Skip to main content

Module like

Module like 

Source
Expand description

Canonical SQL LIKE pattern matching.

This is the single source of truth for LIKE semantics across every query path (storage scan, filter pushdown, expression evaluation, virtual/plugin tables). Historically the engine carried four divergent implementations that disagreed on case sensitivity and on whether regex metacharacters in the subject/pattern were treated literally. They have all been routed through like_match so that LIKE behaves identically regardless of the path a query takes.

§Semantics

  • Case sensitive (SQL-92 standard; collation-aware folding is out of scope).
  • % matches zero or more characters.
  • _ matches exactly one character.
  • Every other character — including regex metacharacters such as ., (, *, [ — matches itself literally. The matcher does not use a regex engine, so no escaping pitfalls exist.

Functions§

like_match
Returns true if s matches the SQL LIKE pattern.