Skip site navigation (1) Skip section navigation (2)

Re: Re-run query on automatic reconnect

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re-run query on automatic reconnect
Date: 2005-09-26 21:03:53
Message-ID: 3248.1127768633@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
"Jim C. Nasby" <jnasby(at)pervasive(dot)com> writes:
> Is there any particular reason why psql doesn't re-run a query that
> failed due to disconnect from the server after re-connecting? I've
> thought maybe it's because it might somehow be dangerous, but I can't
> think of any case where that's actually true.

You haven't thought very hard.

(1) psql cannot tell whether the query was already completed before the
connection dropped; if so, reissuing it would make its effects if any
happen twice (eg, duplicate insert, or adding something to a bank
balance twice).

(2) If inside a transaction block, the query might or might not depend
on previous operations in the same transaction.

(3) The query might depend on previous session-local operations,
such as SET commands or creation of temp tables.

(4) If the query actually caused the server crash, re-issuing it will
probably cause another crash.  Instant infinite loop, complete with
denial of service to all other database users.

			regards, tom lane

In response to

pgsql-hackers by date

Next:From: Dann CorbitDate: 2005-09-26 21:13:02
Subject: Re: [PERFORM] A Better External Sort?
Previous:From: Michael FuhrDate: 2005-09-26 20:52:02
Subject: Re: Re-run query on automatic reconnect

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group