Is the way to get same output as in terminal with ob-doc-sql
.
Executing the sql-query in org will process results into org-table ignoring other than table information. It doesn't fare well with multiple query in the block as show below will squash both into single table.
#+BEGIN_SRC sql :engine postgresql :database postgres
SELECT 'hello';
SELECT 'hello', 'world';
#+END_SRC
#+RESULTS:
| ?column? | |
|----------+----------|
| hello | |
| ?column? | ?column? |
| hello | world |
header argument :results
with output or verbatim value produce correct structure but table formatting is stripped out. But stil doesn't produce any terminal like output as shown below.
#+RESULTS:
: ?column?
: hello world
: ?column? ?column?
: hello world
Althouh expected output can be produced via shell execution,
#+BEGIN_SRC sh :results output
psql postgres -X -c "SELECT 'hello'" -c "SELECT 'hello', 'world';"
#+END_SRC
#+RESULTS:
#+begin_example
?column?
----------
hello
(1 row)
?column? | ?column?
----------+----------
hello | world
(1 row)
#+end_example