Skip to content

Commit 6fc7148

Browse files
committed
readyset-data: Don't decode enum indices in DfValue's FromSql impl
Now that we're no longer using this code for proxying, we can change it to match the other Postgres code, which fixes REA-3143. Other than the aforementioned bug, it didn't hurt anything to decode them here, but it is now redundant since we already decode them in all the other necessary places for replication/writes/query parameters/etc. Fixes: REA-3143 Change-Id: I8da9a33669ccbab09e3e0a9013c12d040068fe69 Reviewed-on: https://gerrit.readyset.name/c/readyset/+/5540 Tested-by: Buildkite CI Reviewed-by: Jason Brown <[email protected]> Reviewed-by: Aspen Smith <[email protected]>
1 parent 396f41c commit 6fc7148

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

readyset-data/src/lib.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,18 +1813,7 @@ impl<'a> FromSql<'a> for DfValue {
18131813
}
18141814
match ty.kind() {
18151815
Kind::Array(_) => mk_from_sql!(Array),
1816-
Kind::Enum(variants) => {
1817-
let variant_str = str::from_utf8(raw)?;
1818-
Ok(DfValue::from(
1819-
variants
1820-
.iter()
1821-
.position(|v| v == variant_str)
1822-
.ok_or("Unknown enum variant")?
1823-
// To be compatible with mysql enums, we always represent enum values as
1824-
// *1-indexed* (since mysql needs 0 to represent invalid values)
1825-
+ 1,
1826-
))
1827-
}
1816+
Kind::Enum(_) => mk_from_sql!(&str),
18281817
_ => match *ty {
18291818
Type::BOOL => mk_from_sql!(bool),
18301819
Type::CHAR => mk_from_sql!(i8),

readyset-psql/tests/fallback.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,6 @@ async fn insert_enum_value_appended_after_create_table() {
881881
shutdown_tx.shutdown().await;
882882
}
883883

884-
#[ignore = "REA-3143 Test reproduces error due to known bug"]
885884
#[tokio::test(flavor = "multi_thread")]
886885
#[serial]
887886
async fn insert_array_of_enum_value_appended_after_create_table() {

0 commit comments

Comments
 (0)