Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion backend/src/baserow/contrib/database/fields/field_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5676,7 +5676,7 @@ def get_fields_needing_periodic_update(self) -> Optional[QuerySet]:
table__trashed=False,
table__database__trashed=False,
table__database__workspace__trashed=False,
)
).exclude(formula_type=BaserowFormulaInvalidType.type)

def run_periodic_update(
self,
Expand Down
24 changes: 24 additions & 0 deletions backend/tests/baserow/contrib/database/field/test_field_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,3 +581,27 @@ def test_link_row_fields_deps_are_excluded_from_periodic_updates(data_fixture):

row_a.refresh_from_db()
assert getattr(row_a, formula_a.db_column) == "02"


@pytest.mark.django_db
def test_invalid_formula_is_skipped_by_periodic_update(data_fixture):
table = data_fixture.create_database_table()
date_field = data_fixture.create_date_field(table=table, date_include_time=True)
bool_formula = data_fixture.create_formula_field(
table=table,
formula=f"today() > field('{date_field.name}')",
)
data_fixture.create_formula_field(
table=table,
formula=f"if(field('{bool_formula.name}'), 'YES', 'NO')",
)

assert bool_formula.needs_periodic_update is True
assert bool_formula.formula_type == "boolean"

bool_formula.mark_as_invalid_and_save("simulated invalid state")
bool_formula.refresh_from_db()
assert bool_formula.formula_type == "invalid"
assert bool_formula.needs_periodic_update is True

assert FormulaFieldType().get_fields_needing_periodic_update().exists() is False
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "bug",
"message": "Skip invalid formula fields in the periodic field update task.",
"issue_origin": "github",
"issue_number": 5298,
"domain": "database",
"bullet_points": [],
"created_at": "2026-05-04"
}
Loading