Skip to content

Commit

Permalink
loosen SQL grammar for UPDATE statement (#910)
Browse files Browse the repository at this point in the history
  • Loading branch information
anzdaddy authored Feb 14, 2024
1 parent f36ce2f commit ffee6d3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
Binary file modified internal/bundles/assets/import_sql_cli.arraiz
Binary file not shown.
5 changes: 1 addition & 4 deletions pkg/importer/sql/sql.arrai
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ attr_alteration -> ("ALTER" | "MODIFY") "COLUMN"? column_name
(action=("SET" | "DROP") NOT_NULL | "SET" (options_def | default) | "TYPE"? attr_type);

//# Spanner
update_table -> "UPDATE" table_name
"SET" update_item:","
("WHERE" condition)?;
update_item -> column_name "=" (value | "DEFAULT");
update_table -> "UPDATE" /{(?: :[^};] | [^:;] )*};
//#FIXME: stack breaks in macros
condition -> cond_stmt:("AND"|"OR");
cond_stmt -> bool_value | "(" condition ")" | (column_name | value) (("IS" "NOT"? NULL) | comparison value);
Expand Down
1 change: 1 addition & 0 deletions pkg/importer/sql/sql_test.arrai
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ let (:macro, :applyStmt, :emptyModel, :parseDdl, ...) = //{./sql};
,
whereEqual: parseDdl(`UPDATE t SET c=1 WHERE 1=1`) = [{}],
whereTrue: parseDdl(`UPDATE t SET c=1 WHERE TRUE`) = [{}],
expr: parseDdl(`UPDATE t SET x = x + 1 WHERE 1 = 1;`) = [{}],
),

set: [
Expand Down

0 comments on commit ffee6d3

Please sign in to comment.