Permalink
Browse files

SQLFile: In CREATE TABLE regex, allow . to match newlines

Previously, garbage content before or after the CREATE TABLE was causing match
failure (causing Skeema to report the file as invalid) instead of properly
ignoring the extra content.
  • Loading branch information...
evanelias committed Dec 21, 2016
1 parent 1e787f0 commit 634a8d03a344263355429262ce0092773707782d
Showing with 1 addition and 1 deletion.
  1. +1 −1 sqlfile.go
View
@@ -16,7 +16,7 @@ import (
// [2] is the table name -- note we do not allow whitespace even if backtick-escaped
// [3] is the table body -- later we scan this for disallowed things
// [4] is any text after the table body -- we ignore this
-var reParseCreate = regexp.MustCompile(`(?i)^(.*)\s*create\s+table\s+(?:if\s+not\s+exists\s+)?` + "`?([^\\s`]+)`?" + `\s+([^;]+);?\s*(.*)$`)
+var reParseCreate = regexp.MustCompile(`(?is)^(.*)\s*create\s+table\s+(?:if\s+not\s+exists\s+)?` + "`?([^\\s`]+)`?" + `\s+([^;]+);?\s*(.*)$`)
// We disallow CREATE TABLE SELECT and CREATE TABLE LIKE expressions
var reBodyDisallowed = regexp.MustCompile(`(?i)^(as\s+select|select|like|[(]\s+like)`)

0 comments on commit 634a8d0

Please sign in to comment.