Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions sqlx-postgres/src/types/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,12 @@ where
let mut buf = value.as_bytes()?;

if value.format() == PgValueFormat::Binary && value.type_info == PgTypeInfo::JSONB {
assert_eq!(
buf[0], 1,
"unsupported JSONB format version {}; please open an issue",
buf[0]
);
// Check JSONB version byte - PostgreSQL currently only supports version 1
if buf[0] != 1 {
return Err(
format!("unsupported JSONB format version {} (expected 1)", buf[0]).into(),
);
}

buf = &buf[1..];
}
Expand Down