When running on Windows, @
dereferencing doesn't work when using paths with backslashes in sqltool command-lines, nor with the SqlFile constructions that accept File arguments.
For instance, for a script check-db-setup.sql
that includes other scripts via \i @/other-script.sql
, this constructor works,
new SqlFile(new URL("file", null, "sql/check-db-setup.sql"));
while this does not
new SqlFile(new File("sql/check-db-setup.sql"));
Please confirm that the problem is with regular forward slashes within filepaths, not backslashes.
Please paste the error message or indication.
When using the Java API, the problem occurs with forward slashes when using File constructors:
Using this constructor for SqlFile
SqlFile sqlFile = new SqlFile(new URL("file", null, "GPD/sql/check-db-setup.sql"));
everything works fine with '@' dereferencing in check-db-setup.sql.
When using this constructor:
SqlFile sqlFile = new SqlFile(new File("GPD/sql/check-db-setup.sql"));
one gets the error message below:
check-db-setup.sql and setup-sample-db.sql are in the same directory.
The attached patch, which normalizes backslashes to forward slashes in both
this.atBase
and passed paths, fixes the issue (at least for me...) with usingnew File()
constructors, and also lets one use backslashes in SQL file paths on thesqltool
commandline.Ty. It will be some days until I'll be able to test this. In case I see different behavior, what JRE are you using?
The above behavior (and fix) occurs on Oracle Java 1.7.0_261, Zulu OpenJDK 1.8.0_252, and AdoptOpenJDK 14.0.2, all with Windows x64 arch.
Tested behavior. Ran SqlTool regression tests. Committed patch to base/trunk with rev. 6168.
Thanks.