mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-19 16:44:07 +00:00
fix(#2407): respect the HaltIfNull opcode when determining nullability
This commit is contained in:
committed by
Austin Bonander
parent
15458fa9d6
commit
bd3eb94737
@@ -125,6 +125,7 @@ const OP_CONCAT: &str = "Concat";
|
||||
const OP_OFFSET_LIMIT: &str = "OffsetLimit";
|
||||
const OP_RESULT_ROW: &str = "ResultRow";
|
||||
const OP_HALT: &str = "Halt";
|
||||
const OP_HALT_IF_NULL: &str = "HaltIfNull";
|
||||
|
||||
const MAX_LOOP_COUNT: u8 = 2;
|
||||
|
||||
@@ -942,6 +943,16 @@ pub(super) fn explain(
|
||||
state.r.insert(p2, RegDataType::Single(ColumnType::null()));
|
||||
}
|
||||
|
||||
// if there is a value in p3, and the query passes, then
|
||||
// we know that it is not nullable
|
||||
OP_HALT_IF_NULL => {
|
||||
if let Some(RegDataType::Single(ColumnType::Single { nullable, .. })) =
|
||||
state.r.get_mut(&p3)
|
||||
{
|
||||
*nullable = Some(false);
|
||||
}
|
||||
}
|
||||
|
||||
OP_FUNCTION => {
|
||||
// r[p1] = func( _ )
|
||||
match from_utf8(p4).map_err(Error::protocol)? {
|
||||
|
||||
Reference in New Issue
Block a user