Skip to content

Conversation

@tisonkun
Copy link
Collaborator

No description provided.

- Export SqlWriterValues publicly
- Add Select::to_values() returning SqlWriterValues
- PG placeholder style: , , ...
- Add Expr::Custom to well_known_no_parentheses (no extra parens)
- select_37a: nested NOT expressions with TRUE/FALSE
- Change from Expr::custom to Expr::value(true/false)
- SQL generated:  OR  with collected values
- Demonstrates pqb's aggressive parameterization vs sea-query's inline
- select_44: NOT with single condition
- select_45: NOT with OR
- select_46: NOT with AND semantics
- select_47: NOT with AND compound
- select_48: Tuple comparison
- select_49: SELECT * with asterisk
Signed-off-by: tison <wander4096@gmail.com>
Comment on lines +315 to +329
pub fn in_tuples<T, I>(self, tuples: I) -> Expr
where
T: IntoIterator<Item = Expr>,
I: IntoIterator<Item = T>,
{
self.binary(
BinaryOp::In,
Expr::Tuple(
tuples
.into_iter()
.map(|t| Expr::Tuple(t.into_iter().collect()))
.collect(),
),
)
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed sea-query has ValueTuple and ValueTupleIter design, but I wonder if they are over-designed or can be replaced with SmallVec<Value; 3>.

@Huliiiiii could you share some background why you introduce ValueTuple in sea-query?

FYI, pqb is a fork of sea-query to trim down code for dedicated PG query builder.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no specific reason. We chose not to replace it with smallvec in 1.0 mainly to maintain compatibility.

Select::new()
.column("id")
.from("glyph")
.and_where(Expr::tuple([Expr::column("aspect"), Expr::value("100")]).in_tuples([[Expr::value(8), Expr::value("100")]]))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed that IntoValueTuple and ValueTuple are to help write code like:

.in_tuples([(8, "100)])

rather than:

.in_tuples([[Expr::value(8), Expr::value("100")]]))

But Expr::tuple already has the same short-coming.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave it as further improvement if we do find it very helpful.

@tisonkun tisonkun merged commit 899f993 into main Jan 27, 2026
9 checks passed
@tisonkun tisonkun deleted the more-kimi branch January 27, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants