Thread: psql default options

psql default options

From
Gregory Stark
Date:
For a long time one of the big gripes we get is that when using psql
interactively if you turn autocommit off and you typo on the nth command
you've suddenly lost all your work. The response was always that we needed a
generic subtransaction facility to handle it.

We've had such a facility for a while but we're still biting people with the
same problem.

I would like to suggest that we make psql default when in interactive mode to
using AUTOCOMMIT=false and ON_ERROR_ROLLBACK=true.

Defaulting to autocommit=false is somewhat surprising and a big change. I
recall the first time I used Oracle I was completely flummoxed by having
autocommit off. I know that'll be a hard sell.

But as I used it I grew quite fond of having autocommit off. It's saved my
bacon more than once. I strongly recommend it to anyone working with data they
care about even a little bit. Being able to double check your work results
before committing them is extremely valuable.

So basically what I'm saying is that I think what I recommend users use should
just be the default when using psql interactively.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com



Re: psql default options

From
Tom Lane
Date:
Gregory Stark <stark@enterprisedb.com> writes:
> I would like to suggest that we make psql default when in interactive mode to
> using AUTOCOMMIT=false and ON_ERROR_ROLLBACK=true.

That is *way* too big a behavioral change to make depend on something as
fragile as whether psql thinks it's interactive or not.
        regards, tom lane


Re: psql default options

From
Jim Nasby
Date:
On Apr 27, 2007, at 12:44 AM, Tom Lane wrote:
> Gregory Stark <stark@enterprisedb.com> writes:
>> I would like to suggest that we make psql default when in  
>> interactive mode to
>> using AUTOCOMMIT=false and ON_ERROR_ROLLBACK=true.
>
> That is *way* too big a behavioral change to make depend on  
> something as
> fragile as whether psql thinks it's interactive or not.

What about at least documenting it as a recommended practice? I agree  
with Greg that it's a really good way to operate...
--
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)