After further investigation, I find that unbalanced triple quotes works (see https://github.com/JuliaLang/julia/issues/5800) as in $opts = ["--pset=""""footer=off""","-hlocalhost","..."] and also `psql --pset="footer=off" $opts -c $sql` with $opts not containing the --pset=...
On Wednesday, 24 August 2016 06:11:03 UTC-4, Colin Beckingham wrote: > > Sometimes we need to get bits of data from databases. And one of the quick > ways to do this is pass an SQL query to Mysql or Postgresql without loading > up the special database specific (or not) Julia libraries. Backticks work > well up to a point. > For example `psql $opts -c $sql` works nicely if $opts is an array of > strings where there is no space between flag and value, as in > ["-hlocalhost","..."] to indicate which server to access. It has to be an > array, a simple string does not fly since it is inserted with wrapping > quotes intact. The $sql can be a string, which is nice. > I find I can pass pretty much any option in $opts but have hit a roadblock > when trying to pass an output option such as "--pset="footer=off" at which > point I seem to lose control of the quotes again. It's not a blocker since > I can just adjust the result once it has been returned. Just interested to > know if there is a workaround. >