Function: sql-postgres

sql-postgres is an autoloaded, interactive and byte-compiled function defined in sql.el.gz.

Signature

(sql-postgres &optional BUFFER)

Documentation

Run psql by Postgres as an inferior process.

If buffer *SQL* exists but no process is running, make a new process. If buffer exists and a process is running, just switch to buffer
*SQL*.

Interpreter used comes from variable sql-postgres-program. Login uses the variables sql-database and sql-server as default, if set. Additional command line parameters can be stored in the list sql-postgres-options.

The buffer is put in SQL interactive mode, giving commands for sending input. See sql-interactive-mode.

To set the buffer name directly, use C-u (universal-argument) before M-x sql-postgres (sql-postgres). Once session has started, M-x sql-rename-buffer (sql-rename-buffer) can be called separately to rename the buffer.

To specify a coding system for converting non-ASCII characters in the input and output to the process, use C-x RET c (universal-coding-system-argument) before M-x sql-postgres (sql-postgres). You can also specify this with C-x RET p (set-buffer-process-coding-system) in the SQL buffer, after you start the process. The default comes from process-coding-system-alist and default-process-coding-system. If your output lines end with ^M, your might try undecided-dos as a coding system. If this doesn't help, Try to set comint-output-filter-functions like this:

(add-hook 'comint-output-filter-functions #'comint-strip-ctrl-m 'append)

(Type C-h m (describe-mode) in the SQL buffer for a list of commands.)

Probably introduced at or before Emacs version 24.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/sql.el.gz
;;;###autoload
(defun sql-postgres (&optional buffer)
  "Run psql by Postgres as an inferior process.

If buffer `*SQL*' exists but no process is running, make a new process.
If buffer exists and a process is running, just switch to buffer
`*SQL*'.

Interpreter used comes from variable `sql-postgres-program'.  Login uses
the variables `sql-database' and `sql-server' as default, if set.
Additional command line parameters can be stored in the list
`sql-postgres-options'.

The buffer is put in SQL interactive mode, giving commands for sending
input.  See `sql-interactive-mode'.

To set the buffer name directly, use \\[universal-argument]
before \\[sql-postgres].  Once session has started,
\\[sql-rename-buffer] can be called separately to rename the
buffer.

To specify a coding system for converting non-ASCII characters
in the input and output to the process, use \\[universal-coding-system-argument]
before \\[sql-postgres].  You can also specify this with \\[set-buffer-process-coding-system]
in the SQL buffer, after you start the process.
The default comes from `process-coding-system-alist' and
`default-process-coding-system'.  If your output lines end with ^M,
your might try undecided-dos as a coding system.  If this doesn't help,
Try to set `comint-output-filter-functions' like this:

\(add-hook \\='comint-output-filter-functions #\\='comint-strip-ctrl-m \\='append)

\(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
  (interactive "P")
  (sql-product-interactive 'postgres buffer))