Skip to content
This repository has been archived by the owner on Feb 4, 2021. It is now read-only.

syntax error with vitess bootstrap sql files #1

Open
tv42 opened this issue Nov 4, 2015 · 1 comment
Open

syntax error with vitess bootstrap sql files #1

tv42 opened this issue Nov 4, 2015 · 1 comment

Comments

@tv42
Copy link

tv42 commented Nov 4, 2015

Hi. I was curious about sqlfmt and fed it the first *.sql I could find, and got mysterious syntax errors:

$ cat $GOPATH/src/github.com/youtube/vitess/data/bootstrap/_vt_schema.sql 
CREATE DATABASE _vt;

CREATE TABLE _vt.replication_log (
  time_created_ns bigint primary key,
  note varchar(255));

CREATE TABLE _vt.reparent_log (
  time_created_ns bigint primary key,
  last_position varchar(255),
  new_addr varchar(255),
  new_position varchar(255),
  wait_position varchar(255),
  index (last_position));
$ sqlfmt $GOPATH/src/github.com/youtube/vitess/data/bootstrap/_vt_schema.sql 
2015/11/04 15:03:30 parse error: syntax error at character 328
Parse failed
$ head -1 $GOPATH/src/github.com/youtube/vitess/data/bootstrap/_vt_schema.sql | hexdump -C
00000000  43 52 45 41 54 45 20 44  41 54 41 42 41 53 45 20  |CREATE DATABASE |
00000010  5f 76 74 3b 0a                                    |_vt;.|
00000015
$ head -1 $GOPATH/src/github.com/youtube/vitess/data/bootstrap/_vt_schema.sql | sqlfmt
2015/11/04 15:03:38 parse error: syntax error at character 21
Parse failed
$ 
@jackc
Copy link
Owner

jackc commented Nov 5, 2015

Unfortunately, sqlfmt is far from complete. It can handle pretty much anything that can happen in a select statement except CTEs, but not much else. You can look in the testdata directory to see examples of what it does do.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants