ELPA Logo NonGNU ELPA: pg

pg Atom Feed

Description
Socket-level interface to the PostgreSQL database
Latest
pg.tar (.sig), 2026-Aug-12, 0.01 KiB
Maintainer
Other versions:
development version
Website
https://github.com/emarsden/pg-el
ELPA's Repository
CGit or Gitweb
All Dependencies
peg (.tar)
Badge

To install this package from Emacs, use package-install or list-packages.

Full description

pg.el -- Emacs Lisp socket-level interface to the PostgreSQL RDBMS

License: GPL v3 Latest tagged version MELPA NonGNU ELPA test-pgv16 Documentation build

This library lets you access the PostgreSQL 🐘 database management system from Emacs, using its network-level frontend/backend ā€œwireā€ protocol. The module is capable of automatic type coercions from a range of SQL types to the equivalent Emacs Lisp type.

šŸ“– You may be interested in the user manual.

This is a developer-oriented library, which won’t be useful to end users. If you’re looking for a browsing/editing interface to PostgreSQL in Emacs, you may be interested in PGmacs.

This library has support for:

Tested PostgreSQL versions: The code has been tested with versions 19 beta, 18.4, 17.9, 16.13, 15.4, 13.8, 11.17, and 10.22 on Linux. It is also tested via GitHub actions on MacOS and Windows. This library also works, more or less, against other ā€œPostgreSQL-compatibleā€ databases. There are four main points where this compatibility may be problematic:

The following PostgreSQL-compatible databases or extensions have been tested:

PostgreSQL variants or proxies that don’t work with pg-el:

Tested Emacs versions: mostly tested with versions 31 pre-release, 30.2 and 29.4. Emacs versions older than 26.1 will not work against a recent PostgreSQL version (whose default configuration requires SCRAM-SHA-256 authentication), because they don’t include the GnuTLS support which we use to calculate HMACs. They may however work against a database set up to allow unauthenticated local connections. Emacs versions older than 28.1 (from April 2022) will not be able to use the extended query protocol (prepared statements), because they don’t have the necessary bindat functionality. It should however be easy to update the installed version of bindat.el for these older versions.

[!TIP] Emacs 31 (in pre-release) has support for disabling the Nagle algorithm on TCP network connections (TCP_NODELAY). This leads to far better performance for PostgreSQL connections, in particular on Unix platforms. This performance difference does not apply when you connect to PostgreSQL over a local Unix socket connection.

You may be interested in an alternative library emacs-libpq that enables access to PostgreSQL from Emacs by binding to the libpq library.

Installation

Install via the NonGNU ELPA package archive by running the command

M-x package-install RET pg

Alternatively, install via the MELPA package archive by including the following in your Emacs initialization file (.emacs.el or init.el):

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)

then saying

 M-x package-install RET pg

Alternatively, you can install the library from the latest GitHub revision using:

 (unless (package-installed-p 'pg)
    (package-vc-install "https://github.com/emarsden/pg-el" nil nil 'pg))

You can later update to the latest version with M-x package-vc-upgrade RET pg RET.

Acknowledgements

Thanks to Eric Ludlam for discovering a bug in the date parsing routines, to Hartmut Pilch and Yoshio Katayama for adding multibyte support, and to Doug McNaught and Pavel Janik for bug fixes.

Old versions

pg-0.68.tar.lz2026-Jul-19 150 KiB
pg-0.67.tar.lz2026-Jun-07 148 KiB
pg-0.66.tar.lz2026-May-02 147 KiB
pg-0.65.tar.lz2026-Apr-18 146 KiB
pg-0.64.tar.lz2026-Mar-28 145 KiB
pg-0.63.tar.lz2026-Feb-08 143 KiB
pg-0.62.tar.lz2025-Dec-26 142 KiB
pg-0.61.tar.lz2025-Nov-22 139 KiB
pg-0.60.tar.lz2025-Sep-21 136 KiB
pg-0.59.tar.lz2025-Aug-31 134 KiB
pg-0.58.tar.lz2025-Aug-13 130 KiB
pg-0.57.tar.lz2025-Jul-30 127 KiB
pg-0.56.tar.lz2025-Jul-20 124 KiB
pg-0.55.tar.lz2025-Jul-14 124 KiB

News

Changelog

[0.69] - 2026-08-12

[0.68] - 2026-06-19

[0.67] - 2026-06-07

[0.66] - 2026-05-02

[0.65] - 2026-04-18

[0.64] - 2026-03-28

[0.63] - 2026-02-08