Version 0.61 of package Pg has just been released in NonGNU ELPA. You can now find it in M-x list-packages RET.
Pg describes itself as: ================================================= Socket-level interface to the PostgreSQL database ================================================= More at https://elpa.nongnu.org/nongnu/pg.html ## Summary: # pg.el -- Emacs Lisp socket-level interface to the PostgreSQL RDBMS ## Recent NEWS: # Changelog ## [0.61] - 2025-11-22 - Add support for providing a password for authentication as a function, rather than as a string. This allows for integration with the auth-source functionality in Emacs, and helps to reduce the length of time where passwords remain present in RAM. Patch from @Kaylebor. - New error class `pg-invalid-sql-statement-name` which is signalled when an invalid name is given to a prepared query. - New error class `pg-invalid-cursor-name` which is signalled when an invalid name is used for a cursor. - Integer arrays and floating point arrays containing NULL values will now be parsed correctly. ## [0.60] - 2025-09-21 - Add support for version 3.2 of the wire protocol, introduced in PostgreSQL v18. The only change with respect to the previously supported version 3.0 is the length of the key used to authenticate requests to cancel an ongoing query. As for libpq, we default to using version 3.0, because several PostgreSQL variants do not support version 3.2 and have not yet implemented the protocol version downgrade functionality that is designed into the protocol. Version 3.2 of the protocol can be selected by passing `(3 . 2)` as the value for the `:protocol-version` argument to `pg-connect-plist` and `pg-connect/direct-tls`, or by using a `protocol_version` URL parameter to `pg-connect/uri`. - New function to establish PostgreSQL connections `pg-connect-plist`. This function is similar to `pg-connect`, but takes keyword arguments instead of optional arguments. Function `pg-connect` is deprecated. Similarly, the new macro `with-pg-connection-plist` should be used instead of `with-pg-connection` in new code. - Recently introduced function `pg-connect/direct-tls` has been deprecated; use the `:direct-tls` option to `pg-connect-plist` instead. - Add detection code and workarounds for the PostgreSQL variants OpenGauss (by Huawei) and pgsqlite. - Add parsing support for arrays of time- and date-related objects. - The input and output buffers used for communication with PostgreSQL are now trimmed when they become too large, with only the most recent data retained. The number of octets to retain for each buffer can be customized using the variable `pg-connection-buffer-octets`. ## [0.59] - 2025-08-31 - Add detection code and workarounds for the Yellowbrick PostgreSQL variant. - Add support for parsing an `options` parameter in a connection string or connection URI, or for parsing the contents of the `PGOPTIONS` environment variable (as per the [libpq behaviour](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS)). This is an alternative to using elisp code on `pg-new-connection-hook`. - Fixes for serializing `bpchar` values when they are used by PostgreSQL to represent `CHAR(N)` fields (bug reported by @Tekki). - Change the mechanism used to send messages to PostgreSQL: instead of sending data incrementally we accumulate data in a per-connection output buffer and send it in a chunk when `pg-flush` is called. This should reduce the number of small fragmented network packets exchanged with the PostgreSQL backend, and should improve performance. ## [0.58] - 2025-08-13 - Add serialization support for the `numeric` data type, for arguments to prepared statements. - Add serialization support for homogeneous arrays when using the extended query protocol. Types such as `text[]` (known as `_text` in the `pg_type` system table), `int4[]`, `float4[]`, `float8[]` can now be passed as function arguments. - Fix parsing of the `bpchar` type, which PostgreSQL uses on the wire to represent `CHARACTER(N)` objects. These objects would previously be truncated to their first character, but are now parsed as a full length string if the length is greater than 1 character, and still as an Emacs Lisp character when the length is equal to 1. The returned string includes trailing padding spaces if the value inserted is less long than the field width. Bug reported by @Tekki. ... ...
