Skip to content

Commit afed3e5

Browse files
authored
Merge pull request #35 from PostHog/fix/copy-stdin-regex
Fix COPY FROM STDIN regex to handle transpiled SQL
2 parents 51d27be + cfd7148 commit afed3e5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/conn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ func (c *clientConn) buildCommandTag(cmdType string, result sql.Result) string {
608608
// Regular expressions for parsing COPY commands
609609
var (
610610
copyToStdoutRegex = regexp.MustCompile(`(?i)COPY\s+(.+?)\s+TO\s+STDOUT`)
611-
copyFromStdinRegex = regexp.MustCompile(`(?i)COPY\s+(\S+)\s+(?:\(([^)]+)\)\s+)?FROM\s+STDIN`)
611+
copyFromStdinRegex = regexp.MustCompile(`(?i)COPY\s+(\S+)\s*(?:\(([^)]+)\)\s*)?FROM\s+STDIN`)
612612
copyWithCSVRegex = regexp.MustCompile(`(?i)\bCSV\b`)
613613
copyWithHeaderRegex = regexp.MustCompile(`(?i)\bHEADER\b`)
614614
copyDelimiterRegex = regexp.MustCompile(`(?i)\bDELIMITER\s+['"](.)['"]\b`)

0 commit comments

Comments
 (0)