help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interacting with PostgreSQL


From: Tim Landscheidt
Subject: Re: Interacting with PostgreSQL
Date: Wed, 25 Nov 2020 10:37:28 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Jean Louis <bugs@gnu.support> wrote:

> […]

>> Also, my mind will be focussed on fixing the functions/etc.  Worst
>> case is that I miss that psql has reverted to auto-commit mode and
>> my not-yet-working trigger/query overwrites good data with garbage.

> OK, I do not know about that. And I am not using auto commit mode, did
> not know that it exists and will not switch to it.

The problem is that you do not need to consciously use auto-
commit mode, but that psql automatically reverts to it when
you rollback or commit a transaction:

| tim=> BEGIN WORK;
| BEGIN
| tim=> INSERT INTO t (ID) VALUES (1);
| INSERT 0 1
| tim=> ROLLBACK WORK;
| ROLLBACK
| tim=> INSERT INTO t (ID) VALUES (1);
| INSERT 0 1
| tim=> -- The row has been committed.

You can set the AUTOCOMMIT variable to off, but that does
not turn auto-commit off, but instead silently inserts BEGIN
statements where psql thinks they are useful; it can also
interfere with scripts that except auto-commit to be on.

> […]

> I am interested in your work.

> What do you store in the database?

> Do you interact through Emacs with it?

Yes, that was the point of my question :-).  I use Postgre-
SQL to store most data that fits a relational model and (for
a huge part) use Emacs to interact with it.  I also use a
number of Perl scripts for daily consistency checks and
other Perl/Python scripts where either the input/output will
be part of a pipeline or there is a modal UI that I do not
(yet) have the motivation to rewrite in Emacs Lisp (e. g.,
playing a podcast in the background and "afterwards" asking
the user whether the podcast should be marked as "heard" and
then update the database accordingly before archiving/delet-
ing the podcast file).

Tim




reply via email to

[Prev in Thread] Current Thread [Next in Thread]