Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SQL] [MySQL] support for REPLACE #4117

Merged
merged 1 commit into from
Dec 18, 2024
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
5 changes: 4 additions & 1 deletion SQL/MySQL.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,10 @@ contexts:
dml-statements:
- meta_append: true
- include: index-hint-lists
- match: \b(?i:insert(\s+(?:ignore\s+)?into)?)\b
- match: \b(?i:insert(?:\s+ignore)?(?:\s+into)?)\b
scope: keyword.other.dml.sql
push: expect-table-name
- match: \b(?i:replace\s+(?:into)?)\b
scope: keyword.other.dml.sql
push: expect-table-name
- match: \b(?i:limit)\b
Expand Down
32 changes: 32 additions & 0 deletions SQL/tests/syntax/syntax_test_mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4651,3 +4651,35 @@ EXPLAIN ANALYZE FORMAT=TREE SELECT * FROM t3 WHERE pk > 17;
CREATE USER 'read' IDENTIFIED BY 'toor';
GRANT SELECT ON * . * TO 'read';
FLUSH PRIVILEGES;


REPLACE INTO test2 VALUES (1, 'Old', '2014-08-20 18:47:00');
-- ^^^^^^^^^ keyword.other.dml
-- ^^^^^ meta.table-name
-- ^^^^^^ keyword.other
REPLACE test2 VALUES (1, 'Old', '2014-08-20 18:47:00');
-- ^^^^ keyword.other.dml
-- ^^^^^ meta.table-name
-- ^^^^^^ keyword.other

INSERT IGNORE INTO users_partners (uid,pid) VALUES (1,1);
-- ^^^^^^^^^^^^^^^ keyword.other.dml
-- ^^^^^^^^^^^^^^ meta.table-name
-- ^^^^^^^^^ meta.group
-- ^ punctuation.section.group.begin
-- ^^^ meta.column-name
-- ^ punctuation.separator.sequence
-- ^^^ meta.column-name
-- ^ punctuation.section.group.end
-- ^^^^^^ keyword.other
-- ^^^^^ meta.group
-- ^ punctuation.section.group.begin
-- ^ meta.number.integer.decimal constant.numeric.value
-- ^ punctuation.separator.sequence
-- ^ meta.number.integer.decimal constant.numeric.value
-- ^ punctuation.section.group.end
-- ^ punctuation.terminator.statement

INSERT IGNORE users_partners (uid,pid) VALUES (1,1);
-- ^^^^^^^^^^ keyword.other.dml
-- ^^^^^^^^^^^^^^ meta.table-name
Loading