You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use jsonb_set_lax for JSONB partial updates when targeting PostgreSQL 16 or later so SQL null values are written as JSON null rather than nulling the whole document. Keep older PostgreSQL versions on jsonb_set/json_set with a JSON null fallback for nullable update values.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@@ -47,7 +49,7 @@ public override async Task Update_property_inside_associate()
47
49
@p='foo_updated'
48
50
49
51
UPDATE "RootEntity" AS r
50
-
SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{String}', to_jsonb(@p))
52
+
SET "RequiredAssociate" = jsonb_set_lax(r."RequiredAssociate", '{String}', to_jsonb(@p))
51
53
""");
52
54
}
53
55
@@ -58,7 +60,7 @@ public override async Task Update_property_inside_associate_with_special_chars()
58
60
AssertExecuteUpdateSql(
59
61
"""
60
62
UPDATE "RootEntity" AS r
61
-
SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{String}', to_jsonb('{ Some other/JSON:like text though it [isn''t]: ממש ממש לאéèéè }'::text))
63
+
SET "RequiredAssociate" = jsonb_set_lax(r."RequiredAssociate", '{String}', to_jsonb('{ Some other/JSON:like text though it [isn''t]: ממש ממש לאéèéè }'::text))
62
64
WHERE (r."RequiredAssociate" ->> 'String') = '{ this may/look:like JSON but it [isn''t]: ממש ממש לאéèéè }'
63
65
""");
64
66
}
@@ -72,7 +74,7 @@ public override async Task Update_property_inside_nested_associate()
72
74
@p='foo_updated'
73
75
74
76
UPDATE "RootEntity" AS r
75
-
SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{RequiredNestedAssociate,String}', to_jsonb(@p))
77
+
SET "RequiredAssociate" = jsonb_set_lax(r."RequiredAssociate", '{RequiredNestedAssociate,String}', to_jsonb(@p))
76
78
""");
77
79
}
78
80
@@ -85,7 +87,7 @@ public override async Task Update_property_on_projected_associate()
85
87
@p='foo_updated'
86
88
87
89
UPDATE "RootEntity" AS r
88
-
SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{String}', to_jsonb(@p))
90
+
SET "RequiredAssociate" = jsonb_set_lax(r."RequiredAssociate", '{String}', to_jsonb(@p))
89
91
""");
90
92
}
91
93
@@ -129,7 +131,7 @@ public override async Task Update_nested_associate_to_parameter()
0 commit comments