Questions tagged [sql-mode]
28 questions
10
votes
1 answer
Is there a company backend for completion in sql-interactive-mode?
I'm using sql-interactive-mode, and I'm in need for a Company backends that will complete SQL keywords, and preferably, also column/table names of the used database.
When looking around for any completion, to my surprise, there was no backend for…

ReneFroger
- 3,855
- 22
- 63
8
votes
2 answers
Is it possible to have shared #+PROPERTY: between multiple org files?
I'm working with org-mode and org-babel to query a PostgreSQL database. It's pretty cool setup and I love it.
At the moment, I have multiple org files with the same database property configuration like the following.
#+PROPERTY: header-args:sql…

WarFox
- 251
- 1
- 6
5
votes
1 answer
Eval SQL in Org Babel using sql-connection-alist for credentials
I would like to evaluate SQL source blocks in Org Babel using the connections I have set up in sql-connection-alist from sql-mode. This way I can save database credentials in a private (Elisp) file and share the files with the queries.
Is there any…

Conor
- 475
- 3
- 11
5
votes
2 answers
How to indent SQL code just 4 spaces, without alignment &c?
SQL mode has some cool stuff set up for indenting with aligned keywords and such. Normally, I'd think it was cool. The problem is that at my new job, the people who wrote our mountains of sql did not have this set up, and just indented sql 4…

user3113723
- 181
- 6
4
votes
1 answer
Why do sql-mode and sql-interactive-mode not highlight strings the same way?
Here is a screenshot showing the difference between sql-interactive-mode (top) and sql-mode (bottom).
Why does the string not get highlighted properly in sql-interactive-mode? (Note - this also happens with no color theme enabled.

Trevoke
- 2,375
- 21
- 34
4
votes
1 answer
sql-connect with Ivy
I've switched from helm to Ivy and mostly everything works, but today I noticed that connecting to databases with sql-connect doesn't work anymore. I have the following in the variable sql-connection-alist
(setq sql-connection-alist
'(("dev"…

flooose
- 511
- 6
- 14
4
votes
2 answers
How to change the indentation of major mode (SQL-mode)?
Configuration:
Emacs 25.0.50 on Ubuntu 15.04.
How to produce?
Do emacs -Q, then M-x sql-mode.
Paste the following in the buffer:
SELECT SUM(T01.foobar)
FROM db_foo.bar T01
WHERE T01.fooID = 1
AND T01.barID = 2
AND T01.foo IS NOT NULL'
When…

ReneFroger
- 3,855
- 22
- 63
3
votes
0 answers
Send custom commands via psql interface
When interacting with postgresql via Emacs sql-postgres, is it possible to write aliases or functions, to be able to type for example, databases instead of \l, when I want to list all databases?

Nsukami _
- 6,341
- 2
- 22
- 35
3
votes
0 answers
How to abort a command executing in sqli-mode?
Whilst using a sqli buffer I accidentally ran a mahoosive query. What's the easiest way to abort it?
I used sql-postgres to start the process.

cammil
- 509
- 3
- 12
3
votes
1 answer
Using sql-sqlite via TRAMP
I want to use sql-sqlite on a remote database file via TRAMP. According to this website it should be possible, but I cannot get it to work.
I visit the remote directory with Dired and then invoke sql-sqlite:
C-x d /user@host:/directory
M-x…

Thomas
- 31
- 1
2
votes
0 answers
Does `sql-mysql` work on MS Windows?
I remember that a few years ago when I tried there was an issue with the mysql client not supporting pipes on Windows or something like that, so it didn't work.
I tried sql-mysql with Emacs 27 and it is able to connect to the server, appears to send…

Tom
- 1,190
- 7
- 16
2
votes
1 answer
How to send a string to the SQLi (sql-mode/sql-interactive-mode) buffer after processing?
How can I send a selected region in the sql-mode buffer to an external shell command and let the result be displayed in the sql-interactive-mode buffer (REPL)?
For example, normally, if I select a region in the sql-mode buffer (e.g. my_table) and…

tinlyx
- 1,276
- 1
- 12
- 27
2
votes
0 answers
SQL comint history saves spaces are \40
When accessing a database through an inferior process (M-x sql-msql) the history for the current session history (M-p/n) works Ok. But when restoring history entries from a previous session the string '\40' is found where spaces are supposed to be.…

PuercoPop
- 396
- 2
- 11
2
votes
1 answer
Are comment style flags insufficient to separate SQL comments?
I am trying to understand why SQL mode accepts -* as a comment block start.
In sql.el, I read:
(defvar sql-mode-syntax-table
(let ((table (make-syntax-table)))
;; C-style comments /**/ ...
(modify-syntax-entry ?/ ". 14" table)
…

Michel de Ruiter
- 213
- 2
- 7
2
votes
1 answer
Shortcut to restart sql-postgres process from sql-mode buffer?
Is there a shortcut key or command in Emacs (25.x under Unbuntu 18.04 LTS) to restart the sql-postgres process?
I need to quit and restart sql-postgres very often (for debugging purposes). Currently, my work flow is to
switch to the sql-postgres…

tinlyx
- 1,276
- 1
- 12
- 27