Guile-PG

What is it?

Guile-PG is a collection of modules for Guile allowing access to the PostgreSQL RDBMS from Scheme programs.

The low-level module ‘(database postgres)’, originally written by Ian Grant, provides an almost one-to-one correspondence with the PostgreSQL "libpq" C library interface. The other modules build on it to provide abstractions and convenience procedures:

would leak memory proportional to the number of parameters in
the call. Now, that memory is properly ‘free’d.

‘pg-result-error-field’ works as advertized

Since its introduction w/ Guile-PG 0.30 (2006-04-04), this proc
would always return ‘#f’, i.e., discarding the proper value!
Now, it returns an integer, a symbol or a string, depending on
the field-specified, and ‘#f’ only when the result has no info.

A defs form (for ‘pgtable-manager’) would use ‘**int4’ instead
of ‘int4[][]’. The latter spelling is still supported for the
time being, but will probably be phased out later as Guile 2
becomes more widespread. (Guile 2 can handle square braces in
symbol names but that requires modification to ‘read’, i.e.,
‘(read-disable 'square-brackets)’. This is the method used by
test/table-types.scm, for example.)

‘define-db-col-type-array-variant’ more/less strict

This ‘(database postgres-types)’ proc now throws an error if arg
COMPOSED is not "based on" arg SIMPLE, or if COMPOSED does not
have square braces. Thus, what was documented previously as
mere convention is now elevated to requirement.

On the other hand, COMPOSED may now be a string, as well as a
symbol. (This is the "less strict" part.)

Previously, if the shared-object library failed to load, the
test would display the "dynamic-link: file not found" message
and then (bogusly) pass anyway. How lengthly lameness lasts!

bugfix: ‘INITDB’ value propagated

Previously, for "make check INITDB=/some/dir/initdb", the
specified ‘INITDB’ was ignored. Now it DTRT.

bugfix: adherence to cancellation protocol

The ‘pg-request-cancel’ test now does "COMMIT TRANSACTION" to
finish, and validates that command's success as well. Not doing
so did not cause problems before because the test is the last
one immediately prior to disconnect (see test/basic.scm).

‘pg-result-error-field’ rv checked

Had this been in place earlier, the bug (above) would not have
stood so long. Sigh.

‘COPY’..‘STDIN’ no longer sends "\\.\n"

This is "deprecated" in protocol version 3.0, and probably will
be removed in the future.

delays precise

Previously, the test machinery would use delays to effect
synchronization between client code and the daemon, and
furthermore relied solely on pidfile existence. How lame! Now,
it uses the recommended method, i.e., successful execution of
"psql -l". See README section "Testing".

test database ‘guile_pg_test’ created once

Previously, each test did "CREATE DATABASE" and "DROP DATABASE",
a huge time-consuming redundancy. Now, database creation is
done once on cluster init, and tests take care to delete the
tables that they use, either explicitly with "DROP TABLE", or by
using "CREATE TEMPORARY TABLE" in the first place.

Should a test fail, leaving stray tables behind, you can use new
command "make drop-database" in test/ to rid yourself of the
evidence (after filing a bug report, right!? :-D); the database
will be freshly created on next "make check".

PostgreSQL prior to 9.3 emits a notice on "CREATE TABLE" w/ a
‘serial’ column. As of 9.3, the message is suppressed by
default and only emitted if the client verbosity is at least
‘DEBUG1’. Details in test/basic.scm ‘test:set-notice-out!-1’.

Previously, if "make check" failed, the daemon would be left up,
necessitating manual "make kill-daemon" invocation. Now, there
is test/cleanup.scm, which does not actually test anything;
instead, it kills the daemon (unless ‘KEEPD=1’ is specified).
See README.

documentation changes

license now GNU FDL

The previous text was a weird conglomeration of old
best-practices blurbs (probably).