{"action":"created","issue":{"url":"https://api.github.com/repos/flyway/flyway/issues/921","labels_url":"https://api.github.com/repos/flyway/flyway/issues/921/labels{/name}","comments_url":"https://api.github.com/repos/flyway/flyway/issues/921/comments","events_url":"https://api.github.com/repos/flyway/flyway/issues/921/events","html_url":"https://github.com/flyway/flyway/issues/921","id":53826733,"number":921,"title":"Incorrect parsing when space is missing between end quote and next token","user":{"login":"cosmin","id":1358,"avatar_url":"https://avatars.githubusercontent.com/u/1358?v=3","gravatar_id":"","url":"https://api.github.com/users/cosmin","html_url":"https://github.com/cosmin","followers_url":"https://api.github.com/users/cosmin/followers","following_url":"https://api.github.com/users/cosmin/following{/other_user}","gists_url":"https://api.github.com/users/cosmin/gists{/gist_id}","starred_url":"https://api.github.com/users/cosmin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cosmin/subscriptions","organizations_url":"https://api.github.com/users/cosmin/orgs","repos_url":"https://api.github.com/users/cosmin/repos","events_url":"https://api.github.com/users/cosmin/events{/privacy}","received_events_url":"https://api.github.com/users/cosmin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/flyway/flyway/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/flyway/flyway/labels/Core","name":"Core","color":"fad8c7"},{"url":"https://api.github.com/repos/flyway/flyway/labels/Oracle","name":"Oracle","color":"e11d21"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/flyway/flyway/milestones/6","labels_url":"https://api.github.com/repos/flyway/flyway/milestones/6/labels","id":416157,"number":6,"title":"Flyway 3.2","description":"","creator":{"login":"axelfontaine","id":684824,"avatar_url":"https://avatars.githubusercontent.com/u/684824?v=3","gravatar_id":"","url":"https://api.github.com/users/axelfontaine","html_url":"https://github.com/axelfontaine","followers_url":"https://api.github.com/users/axelfontaine/followers","following_url":"https://api.github.com/users/axelfontaine/following{/other_user}","gists_url":"https://api.github.com/users/axelfontaine/gists{/gist_id}","starred_url":"https://api.github.com/users/axelfontaine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/axelfontaine/subscriptions","organizations_url":"https://api.github.com/users/axelfontaine/orgs","repos_url":"https://api.github.com/users/axelfontaine/repos","events_url":"https://api.github.com/users/axelfontaine/events{/privacy}","received_events_url":"https://api.github.com/users/axelfontaine/received_events","type":"User","site_admin":false},"open_issues":33,"closed_issues":8,"state":"open","created_at":"2013-08-31T11:09:52Z","updated_at":"2015-01-10T08:19:37Z","due_on":"2015-01-31T08:00:00Z","closed_at":null},"comments":3,"created_at":"2015-01-09T02:20:01Z","updated_at":"2015-01-10T08:25:15Z","closed_at":"2015-01-10T08:19:37Z","body":"I noticed some odd errors where Flyway was failing to parse our SQL migrations properly, and ended up concatenating 30,000 lines of SQL together into a single procedure. I traced this down to a bug with parsing string tokens, as evidenced by the following script that should parse as 2 sql statements\r\n\r\n```\r\nCREATE OR REPLACE PROCEDURE FOOBAR\r\n(\r\n\tFOO IN OUT VARCHAR2,\r\n\tBAR\t IN OUT VARCHAR2\r\n)\r\nAS\r\n\r\nBEGIN\r\n\tIF FOO = 'FOO'THEN\r\n\t\tBAR := 'BAR';\r\n\tEND IF;\r\nEND;\r\n/\r\n\r\nCREATE OR REPLACE PROCEDURE BARBAZ\r\n\t(\r\n\t\tBAR\t IN OUT\tVARCHAR2,\r\n\t\tBAZ\t IN OUT\tVARCHAR2\r\n\t)\r\nAS\r\n\r\nBEGIN\r\n\tIF BAR = 'BAR'THEN\r\n\t\tBAZ := 'BAZ';\r\n\tEND IF;\r\nEND;\r\n/\r\n```\r\n\r\nNotice the lack of a space between the `'` and the subsequent `THEN`. This causes Flyway to think it is still inside of a quoted string literal and therefore it continues to parse all of the rest of the file as being part of the current statement.\r\n\r\nI can obviously rewrite the original SQL, but it would be nice to fix the tokenizer to work properly. Every other tool I use parses this statement properly, including IntelliJ, SQL Developer, sqlplus, etc. Having a sql statement work properly in the developer tool, but fail in exciting way when run as part of a migration is obviously not a great behavior.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/flyway/flyway/issues/comments/69448387","html_url":"https://github.com/flyway/flyway/issues/921#issuecomment-69448387","issue_url":"https://api.github.com/repos/flyway/flyway/issues/921","id":69448387,"user":{"login":"axelfontaine","id":684824,"avatar_url":"https://avatars.githubusercontent.com/u/684824?v=3","gravatar_id":"","url":"https://api.github.com/users/axelfontaine","html_url":"https://github.com/axelfontaine","followers_url":"https://api.github.com/users/axelfontaine/followers","following_url":"https://api.github.com/users/axelfontaine/following{/other_user}","gists_url":"https://api.github.com/users/axelfontaine/gists{/gist_id}","starred_url":"https://api.github.com/users/axelfontaine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/axelfontaine/subscriptions","organizations_url":"https://api.github.com/users/axelfontaine/orgs","repos_url":"https://api.github.com/users/axelfontaine/repos","events_url":"https://api.github.com/users/axelfontaine/events{/privacy}","received_events_url":"https://api.github.com/users/axelfontaine/received_events","type":"User","site_admin":false},"created_at":"2015-01-10T08:25:15Z","updated_at":"2015-01-10T08:25:15Z","body":"Should be fixed now. Please try again with your 30000 line file to make sure no edge case was missed.\r\n\r\nCheers,\r\nAxel"}}