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
Fixed Oracle update error - unquoted statement #154
Conversation
ORA-00904: "PASSWORD": invalid identifier Caused by: java.sql.SQLSyntaxErrorException: ORA-00904: "PASSWORD": invalid identifier at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:452) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:400) at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:884) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:471) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:199) at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:535) at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:197) at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:116 5) at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement. java:1444) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement. java:1662) at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:195 8) at oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWr apper.java:1695) at liquibase.snapshot.jvm.ColumnSnapshotGenerator.readColumn(ColumnSnapshot Generator.java:137) at liquibase.snapshot.jvm.ColumnSnapshotGenerator.snapshotObject(ColumnSnap shotGenerator.java:53) ... 21 more
I added PASSWORD as a reserved word without the escapeObjectName() method since I didn't see the reason for overriding that. |
The reason why I've override that method is here: Parent method: public String escapeObjectName(String objectName, Class<? extends DatabaseObject> objectType) {
if (objectName == null || quotingStrategy == ObjectQuotingStrategy.LEGACY) {
return objectName;
} else if (objectName.contains("-") || startsWithNumeric(objectName) || isReservedWord(objectName)) {
return quotingStartCharacter + objectName + quotingEndCharacter;
} else if (quotingStrategy == ObjectQuotingStrategy.QUOTE_ALL_OBJECTS) {
return quotingStartCharacter + objectName + quotingEndCharacter;
}
return objectName;
} Oracle method: public String escapeObjectName(String objectName, Class<? extends DatabaseObject> objectType) {
if (objectName != null) {
if (objectName.contains("-") || startsWithNumeric(objectName) || isReservedWord(objectName)) {
return quotingStartCharacter + objectName + quotingEndCharacter;
} else if (quotingStrategy == ObjectQuotingStrategy.QUOTE_ALL_OBJECTS) {
return quotingStartCharacter + objectName + quotingEndCharacter;
}
}
return objectName;
} The quotingStrategy == ObjectQuotingStrategy.LEGACY in parent, so it's doesn't event check the reserved words. liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: java.sql.SQLSyntaxErrorException: ORA-00904: "PASSWORD": invalid identifier
Caused by: liquibase.exception.DatabaseException: java.sql.SQLSyntaxErrorException: ORA-00904: "PASSWORD": invalid identifier
Caused by: java.sql.SQLSyntaxErrorException: ORA-00904: "PASSWORD": invalid identifier
|
I see that now, thanks. I made the change in AbstractJDbcDatabase because Nathan On Fri, Aug 16, 2013 at 3:35 AM, Nikolay Mukhanov
|
PASSWORD is not a reserved word for Oracle: http://docs.oracle.com/database/121/SQLRF/ap_keywd001.htm Eks: create table test2 ( -- This is my current workaround (using CAPITALS in the changeset) |
From what I can tell, it looks like it was a reserved word in Oracle 10g but removed in 11g. @mukhanov were you running against 10g? |
@nvoxland No it was 11g. |
https://docs.oracle.com/cd/B28359_01/appdev.111/b31231/appb.htm#CJHIIICD doesn't list password for 11g. Do you have an example of the failing SQL? |
List of Oracle keywords is available in view V$RESERVED_WORDS
|
Note that it says 'N' for all the reserved-fields. IOW it isn't actually reserved. See fx. https://docs.oracle.com/cd/B28359_01/server.111/b28320/dynviews_2126.htm#REFRN30204 |
Thanks for the pointer to V$RESERVED_WORDS. It seems like you need non-standard permissions to query it so I can't just pull the word list from there, unfortunately. I created https://liquibase.jira.com/browse/CORE-2143 to track the change. It is more than I would like to do in the 3.3.1 patch release. For now the best work-around is to store password as uppercase in the changelog or use to fix the generated SQL. |
If 10g is different from 11g. should they support with two different driver (or oracledatabase)? Or version specific different should be handled in driver like MSSQL have too many "if majorVersion > 9" around? |
ORA-00904: "PASSWORD": invalid identifier Caused by:
java.sql.SQLSyntaxErrorException: ORA-00904: "PASSWORD": invalid
identifier at
oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:452) at
oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:400) at
oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:884) at
oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:471) at
oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:199) at
oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:535) at
oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:197) at
oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:116
5) at
oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.
java:1444) at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.
java:1662) at
oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:195
8) at
oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWr
apper.java:1695) at
liquibase.snapshot.jvm.ColumnSnapshotGenerator.readColumn(ColumnSnapshot
Generator.java:137) at
liquibase.snapshot.jvm.ColumnSnapshotGenerator.snapshotObject(ColumnSnap
shotGenerator.java:53) ... 21 more