From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: autocommit vs TRUNCATE et al |
Date: | 2002-10-19 01:14:27 |
Message-ID: | 3DB0B1F3.1010407@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> There are a number of statements, such as TRUNCATE TABLE, that refuse to
> run in a transaction block because they perform actions that can't be
> rolled back later.
>
> These statements currently do not look at autocommit, which means that
> if autocommit is off, their tests will succeed ... but then a
> transaction block is started anyway, defeating the point of the test.
>
> We could fix these statements to fail if autocommit is off, which means
> that you could not use them at all except by setting autocommit on.
> Ugh.
>
> Or we could fix them to force an autocommit. Which would mean that
> these "dangerous" statements would become even more dangerous, since
> that's exactly the behavior a person using autocommit-off would not
> expect. Also ugh.
>
> Anyone see a way out of this catch-22? If not, which is the least
> bad alternative?
>
I think the "least bad" is the first option -- disallow TRUNCATE unless
autocommit is on. With the second option, people would be caught by surprise
at precisely the worst possible moment. Better to make them take the extra step.
Joe
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-10-19 01:18:19 | Re: autocommit vs TRUNCATE et al |
Previous Message | Tom Lane | 2002-10-19 01:04:37 | autocommit vs TRUNCATE et al |