Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 06c7785

Browse files
Fix maybeList so it does populate the passed list
Signed-off-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
1 parent 079e419 commit 06c7785

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

sql/parse/util.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ func multiMaybe(matched *bool, strings ...string) parseFunc {
373373
// For example, readList('(', ',', ')', list) parses "(uno, dos,tres)" and
374374
// populates list with the array of strings ["uno", "dos", "tres"]
375375
// If the opening is not found, do not advance the reader
376-
func maybeList(opening, separator, closing rune, list []string) parseFunc {
376+
func maybeList(opening, separator, closing rune, list *[]string) parseFunc {
377377
return func(rd *bufio.Reader) error {
378378
r, _, err := rd.ReadRune()
379379
if err != nil {
@@ -404,10 +404,10 @@ func maybeList(opening, separator, closing rune, list []string) parseFunc {
404404

405405
switch r {
406406
case closing:
407-
list = append(list, newItem)
407+
*list = append(*list, newItem)
408408
return nil
409409
case separator:
410-
list = append(list, newItem)
410+
*list = append(*list, newItem)
411411
continue
412412
default:
413413
return errUnexpectedSyntax.New(

sql/parse/views.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func parseCreateView(ctx *sql.Context, s string) (sql.Node, error) {
3535
skipSpaces,
3636
readIdent(&viewName),
3737
skipSpaces,
38-
maybeList('(', ',', ')', columns),
38+
maybeList('(', ',', ')', &columns),
3939
skipSpaces,
4040
expect("as"),
4141
skipSpaces,

0 commit comments

Comments
 (0)