Cross Dialect Notes
Quarry keeps the SQL shape familiar, but placeholders, quoting, and feature support still follow the configured dialect.
Placeholder output
q := qq.Select("id", "email").
From("users").
Where(quarry.Eq("status", "active"))
| Dialect | SQL |
|---|---|
| Postgres | SELECT id, email FROM users WHERE status = $1 |
| MySQL | SELECT id, email FROM users WHERE status = ? |
| SQLite | SELECT id, email FROM users WHERE status = ? |
Feature gates
RETURNING
Supported by Postgres and SQLite. On MySQL, the builder returns an unsupported feature error instead of pretending the syntax exists.
ILIKE
Native on Postgres. On the other supported dialects Quarry falls back to a LOWER/LIKE pattern so the query stays usable.
ANY
The = ANY(...) form is Postgres-only. The error is explicit on the
other dialects so the caller can choose another shape.
Raw placeholder edge cases
q := qq.Select(quarry.Raw(
"json_extract(meta, '$.status') = ? AND note = 'literal ? stays put'",
"active",
)).From("events")
The raw scanner skips quoted strings, comments, and dollar-quoted bodies before it rewrites placeholders. That is the difference between a useful escape hatch and a fragile text replacement.
Identifier quoting
users := quarry.T("users").As("u")
q := qq.Select(users.Col("id"), users.Col("email")).From(users)
Tables quote with the dialect's identifier rules. MySQL uses backticks; Postgres and SQLite use double quotes.