Skip to content

Commit

Permalink
SQLFile: In CREATE TABLE regex, allow . to match newlines
Browse files Browse the repository at this point in the history
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 634a8d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sqlfile.go
Expand Up @@ -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)`)
Expand Down

0 comments on commit 634a8d0

Please sign in to comment.