I am surprised by the level of quoting seemingly required by org-mode to pass a 
variable to psql in :cmdline



The following works:



#+PROPERTY: header-args:sql :engine postgresql :dbhost  my.host :database mydb 
:dbuser me

#+PROPERTY: header-args:sql+ :tangle no :results table :exports both

#+BEGIN_SRC sql :cmdline "-v this=\\'that\\'"

select :this as this

#+END_SRC



#+RESULTS:

| this |

|------|

| that |





However, I found no other quote/escape combination to work.  At first I 
expected to work:



:cmdline "-v this=\'asdf\'"



... but it is an error.



Is this expected and consistent with other emacs behavior?



Is there another, perhaps simpler, way to pass variables to postgresql  code 
block in org ob-sql?



Thanks,



Malcolm

Reply via email to