postgresql-embedded
postgresql-embedded copied to clipboard
Wrong order of cliArgs in PostgresProcess.restoreFromFile
Currently the order from appending the additional optional command line arguments in PostgresProcess.restoreFromFile is wrong. The filepath / -name of the "pg_restore" command must be located as last param (as described for example here: https://www.postgresql.org/docs/9.6/static/app-pgrestore.html#AEN97925).
So the code in PostgresProcess.restoreFromFile must be written like this:
[...]
String[] args = {
"-U", getConfig().credentials().username(),
"-d", getConfig().storage().dbName(),
"-h", getConfig().net().host(),
"-p", String.valueOf(getConfig().net().port())
};
if (cliArgs != null && cliArgs.length != 0) {
args = ArrayUtils.addAll(args, cliArgs);
}
args = ArrayUtils.add(args, file.getAbsolutePath());
[...]
I just realized this issue in my fork (backport java 1.6): oilid/postgresql-embedded@604f84c