I would like to get possibility to see inline documentation about functions and/or keywords used in SQL (PostgreSQL specifically) code. I know that I can call browser searching from inside Emacs but I would like just to read documentation inside Emacs. This is even enough for me to read info for a specific function/keyword.
Question posted in PostgreSQL
The official documentation can be found here.
The official documentation can be found here.
2
Answers
Emacs comes with a built-in sql-mode that provides syntax highlighting and integration with databases, including PostgreSQL. If you want more PostgreSQL-specific features, you might consider third-party packages like pgsql mode.
Steps:
Enable sql-mode or pgsql-mode in Emacs when editing .sql files:
(add-to-list ‘auto-mode-alist ‘(".sql’" . sql-mode))
For PostgreSQL-specific customizations:
(setq sql-postgres-program "psql") ; Use PostgreSQL client
Documentation is available from the
psql
CLI:h
for SQL statement help.?
for all help topics.You can run
psql
insql-interactive-mode
inside Emacs withM-x sql-postgres
or, if you’ve set up the connection details,M-x sql-connect
.If you connect that buffer to a
sql-mode
buffer, then you can issuepsql
commands fromsql-mode
as well.C-h m
tells you:See also https://www.emacswiki.org/emacs/SqlQueryBuffer