Commit e087e71
authored
fix: normalize NULL date options when constructing BaserowFormulaDateType (baserow#5364)
`FormulaField` allows every date option (`date_format`, `date_include_time`, `date_time_format`, `date_show_tzinfo`) to be NULL because a single row can morph between formula types. For a date-typed formula, however, only `date_force_timezone` is semantically nullable — see `BaserowFormulaDateType.nullable_option_fields`.
When that invariant is violated by an existing row (NULL for a supposedly required option), `construct_type_from_formula_field` built a `BaserowFormulaDateType` carrying those NULLs. The first downstream consumer to access them — `DateFieldType.get_search_expression` building a search expression for `update_search_data` — crashed in `get_date_time_format` with `KeyError: None` (723 occurrences observed in production).
Normalize at the type-construction boundary: when a non-nullable option is NULL on the row, substitute the type's documented default (ISO / False / "24" / False). Downstream code keeps its non-defensive shape, and the same fix protects every other consumer (`get_export_value`, `contains_query`, `get_alter_column_*`).
Fixes baserow#53631 parent b66235f commit e087e71
3 files changed
Lines changed: 82 additions & 1 deletion
File tree
- backend
- src/baserow/contrib/database/formula/types
- tests/baserow/contrib/database/field
- changelog/entries/unreleased/bug
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
875 | 875 | | |
876 | 876 | | |
877 | 877 | | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
878 | 886 | | |
879 | 887 | | |
880 | 888 | | |
| |||
897 | 905 | | |
898 | 906 | | |
899 | 907 | | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
900 | 918 | | |
901 | 919 | | |
902 | 920 | | |
| |||
Lines changed: 55 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
840 | 843 | | |
841 | 844 | | |
842 | 845 | | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
changelog/entries/unreleased/bug/fixes_search_index_updates_failing_for_tables_with_dateonly_.json
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
0 commit comments