Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in 3.2: Invalid charater #971

Closed
davidkarlsen opened this issue Mar 17, 2015 · 6 comments
Closed

Regression in 3.2: Invalid charater #971

davidkarlsen opened this issue Mar 17, 2015 · 6 comments

Comments

@davidkarlsen
Copy link

@davidkarlsen davidkarlsen commented Mar 17, 2015

[ERROR] SQL State : 22019
[ERROR] Error Code : 911
[ERROR] Message : ORA-00911: invalid character
[ERROR] Location : ddl/db/migration/V2__initial_schema.sql (xxxx)
[ERROR] Line : 1
[ERROR] Statement : CREATE TABLE FND_ACCOUNTS (

I've configured
${project.build.sourceEncoding} to UTF-8 - and the file is UTF-8.

It runs fine with flyway 3.1 - same drivers etc.

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Mar 17, 2015

Thanks for the report. Please post the full offending statement, so we can include it in our test cases.

Cheers
Axel

@sho81
Copy link

@sho81 sho81 commented Mar 19, 2015

I can canfirm an Oracle 00911 bug. Take: "COMMENT ON COLUMN SATZ_MARKE.KURZZEICHEN IS 'Kurzzeichen';" <-- Important that it is a single word comment
Then: org.flywaydb.core.internal.dbsupport.SqlStatementBuilder.addLine(String)
does not detect the "terminated" property because org.flywaydb.core.internal.dbsupport.SqlStatementBuilder.endWithOpenMultilineStringLiteral() says true and therefore terminated is NOT set to true although it should. Flyway then continues thinking that three statements are one.
line=COMMENT ON COLUMN SATZ_MARKE.KURZZEICHEN IS 'KURZZEICHEN';
delimitingTokens=[OTHER, OTHER, OTHER, OTHER, OTHER, QUOTE]
Bug seems to me in:
org.flywaydb.core.internal.dbsupport.oracle.OracleSqlStatementBuilder.cleanToken(String)
(I expect QUOTE twice)

Script part:
COMMENT ON COLUMN SATZ_MARKE.KONZERN_ID IS 'Referenz auf einen Konzern';
COMMENT ON COLUMN SATZ_MARKE.KURZZEICHEN IS 'Kurzzeichen';
COMMENT ON COLUMN SATZ_MARKE.STRUKTUR_ID IS 'Referenz zur Struktur';

CREATE OR REPLACE TRIGGER SATZ_MARKE_TR1 BEFORE DELETE OR INSERT OR UPDATE ON SATZ_MARKE
...

Finally: org.flywaydb.core.internal.dbsupport.FlywaySqlScriptException.FlywaySqlScriptException(Resource, SqlStatement, SQLException)
sql="COMMENT ON COLUMN SATZ_MARKE.KURZZEICHEN IS 'Kurzzeichen';
COMMENT ON COLUMN SATZ_MARKE.STRUKTUR_ID IS 'Referenz zur Struktur';

CREATE OR REPLACE TRIGGER SATZ_MARKE_TR1 BEFORE DELETE OR INSERT OR UPDATE ON SATZ_MARKE
..."

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Mar 19, 2015

@sho81 Thanks for the analysis! This will be hugely helpful in fixing this.

@axelfontaine axelfontaine added this to the Flyway 3.2.1 milestone Mar 19, 2015
@cteig
Copy link
Contributor

@cteig cteig commented Mar 19, 2015

Hi,
I also got this Oracle 00911 error and I agree in the analysis of @sho81. It seems like the reason that "org.flywaydb.core.internal.dbsupport.SqlStatementBuilder.endWithOpenMultilineStringLiteral() says true and therefore terminated is NOT set to true although it should" is because of the regexp-string in cleanToken-method.

I got this error in an insert with an single quoted strings that ended with an N. When I debug the cleanToken-method I see 'myStringEndingWithA_N'-token match the regexp-string and return just a single-quote.

I wonder if this pull request from @soemeier is the same error: #973
The code-change in the pull-request, fix my "Illegal-character"-problem. It seems like the Oracle error was introduced iin 699571a

Cheers
Christine Teig

@soemeier
Copy link

@soemeier soemeier commented Mar 20, 2015

Hi,
I agree. We probably have the same issue. So my bug would be a duplicate.

Best Regards

Soeren

@sho81
Copy link

@sho81 sho81 commented Mar 20, 2015

It's definitely the 'N'. I have to correct my first assumption that it must be a single word comment. Flyway 3.1 works fine. I assume there will be a hotfix to this in 3.2.(0.)1 - eagerly awaiting...

jmahonin pushed a commit to jmahonin/flyway that referenced this issue Jul 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants