Skip to content

Commit 251b1f1

Browse files
authored
Merge pull request #65 from LucDeCaf/chore/validate-insert-fields
Prevent inserting invalid data type for ID field
2 parents 0386fb5 + c713249 commit 251b1f1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

crates/core/src/views.rs

+2
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ fn powersync_trigger_insert_sql_impl(
154154
SELECT CASE
155155
WHEN (NEW.id IS NULL)
156156
THEN RAISE (FAIL, 'id is required')
157+
WHEN (typeof(NEW.id) != 'text')
158+
THEN RAISE (FAIL, 'id should be text')
157159
END;
158160
INSERT INTO {:}
159161
SELECT NEW.id, {:};

0 commit comments

Comments
 (0)