Skip to content

Commit e8d49ea

Browse files
committed
store/postgres/relational_queries: Skip empty fulltext field inserts
1 parent 58da519 commit e8d49ea

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

store/postgres/src/relational_queries.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,12 +1049,17 @@ impl<'a> InsertQuery<'a> {
10491049
for column in table.columns.iter() {
10501050
match column.fulltext_fields.as_ref() {
10511051
Some(fields) => {
1052-
let fulltext_updates = fields
1052+
let fulltext_field_values = fields
10531053
.iter()
10541054
.filter_map(|field| entity.get(field))
10551055
.cloned()
1056-
.collect();
1057-
entity.insert(column.field.to_string(), Value::List(fulltext_updates));
1056+
.collect::<Vec<Value>>();
1057+
if !fulltext_field_values.is_empty() {
1058+
entity.insert(
1059+
column.field.to_string(),
1060+
Value::List(fulltext_field_values),
1061+
);
1062+
}
10581063
}
10591064
None => (),
10601065
}

0 commit comments

Comments
 (0)