Default setting for stripComments incorrect for SQL formatted CL - Oracle hints removed.

Description

We had a production performance issue because the Oracle hints which are /* in comments */ are stripped by default. The manual says the default is false, but the code and behaviour is opposite.

Documentation:
"stripComments Set to true to remove any comments in the SQL before executing, otherwise false. Defaults to false if not set"
http://www.liquibase.org/documentation/changes/sql.html

Code:
https://github.com/liquibase/liquibase/blob/9e1b3543e332b3ff1d28669217506e179763ca20/liquibase-core/src/main/java/liquibase/parser/core/formattedsql/FormattedSqlChangeLogParser.java

boolean stripComments = parseBoolean(stripCommentsPatternMatcher, changeSet, true);

Regards,
Bill and our happy band of Liquibasers at Coles

Environment

LInux, Sun Java, Oracle

Activity

Show:

Nathan Voxland May 29, 2014 at 1:12 PM

It may be differences between JDBC drivers. It may also be that inline hints are OK but if you passed something like -`-some comments here\nselect * from dual` it would fail. I've seen that not work, but it may have been on a different database. It will take some quick testing.

Are you running into the problem using an `<sqlFile>` change or formatted sql?

billbirch May 28, 2014 at 10:53 PM

Refer http://docs.oracle.com/cd/E11882_01/java.112/e16548/instclnt.htm#BABFBEBE. Looks like Oracle JDBC does the right thing.

billbirch May 28, 2014 at 10:51 PM

That would depend on the JDBC driver? We're using oracle.jdbc.OracleDriver ojdbc6.jar. Would an oracle JDBC driver really strip Oracle Hints????

Manifest:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.5.0_30-b03 (Sun Microsystems Inc.)
Implementation-Vendor: Oracle Corporation
Implementation-Title: JDBC
Implementation-Version: 11.2.0.3.0
Repository-Id: JAVAVM_11.2.0.3.0_LINUX_110823
Specification-Vendor: Sun Microsystems Inc.
Specification-Title: JDBC
Specification-Version: 4.0

Nathan Voxland May 28, 2014 at 8:38 PM

The FormattedSqlChangeLogParser is different than the sql change. It needs to strip comments or commands passed to JDBC will usually not work.

Do you have an example of your changelog?

Peter Birch November 21, 2013 at 4:55 PM

What's an Oracle hint? AFAIK its a way to give the optimizer instructions about execution to boost performance. e.g.

SELECT /*+ FULL(hr_emp) PARALLEL(hr_emp, 5) */ last_name
FROM employees hr_emp;

See: http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements006.htm#i35922

We use it in our data warehouse.

Details

Reporter

Components

Fix versions

Affects versions

Priority

Created November 21, 2013 at 4:40 PM
Updated March 10, 2016 at 9:16 PM