Skip to content

Commit 437b47a

Browse files
committed
JSON and JSONB can handle different sized arrays inside
1 parent 94e9ca8 commit 437b47a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/value_converter/from_python.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ fn convert_py_to_rust_coord_values(parameters: Vec<Py<PyAny>>) -> PSQLPyResult<V
620620
let parameter_bind = one_parameter.bind(gil);
621621

622622
if !parameter_bind.is_instance_of::<PyFloat>()
623-
& !parameter_bind.is_instance_of::<PyInt>()
623+
&& !parameter_bind.is_instance_of::<PyInt>()
624624
{
625625
return Err(RustPSQLDriverError::PyToRustValueConversionError(
626626
"Incorrect types of coordinate values. It must be int or float".into(),
@@ -717,7 +717,7 @@ pub fn build_geo_coords(
717717
let number_of_coords = result_vec.len();
718718
let allowed_length = allowed_length_option.unwrap_or_default();
719719

720-
if (allowed_length != 0) & (number_of_coords != allowed_length) {
720+
if (allowed_length != 0) && (number_of_coords != allowed_length) {
721721
return Err(RustPSQLDriverError::PyToRustValueConversionError(format!(
722722
"Invalid number of coordinates for this geo type, allowed {allowed_length}, got: {number_of_coords}"
723723
)));
@@ -748,7 +748,7 @@ pub fn build_flat_geo_coords(
748748
let parameters = py_sequence_to_rust(bind_py_parameters)?;
749749
let parameters_length = parameters.len();
750750

751-
if (allowed_length != 0) & (parameters.len() != allowed_length) {
751+
if (allowed_length != 0) && (parameters.len() != allowed_length) {
752752
return Err(RustPSQLDriverError::PyToRustValueConversionError(format!(
753753
"Invalid number of values for this geo type, allowed {allowed_length}, got: {parameters_length}"
754754
)));
@@ -757,7 +757,7 @@ pub fn build_flat_geo_coords(
757757
let result_vec = convert_py_to_rust_coord_values(parameters)?;
758758

759759
let number_of_coords = result_vec.len();
760-
if (allowed_length != 0) & (number_of_coords != allowed_length) {
760+
if (allowed_length != 0) && (number_of_coords != allowed_length) {
761761
return Err(RustPSQLDriverError::PyToRustValueConversionError(format!(
762762
"Invalid number of values for this geo type, allowed {allowed_length}, got: {parameters_length}"
763763
)));

0 commit comments

Comments
 (0)