pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
psql and autocommit
6+ messages / 4 participants
[nested] [flat]

* psql and autocommit
@ 2004-08-23 13:21  Tsirkin Evgeny <tsurkin@mail.jct.ac.il>
  0 siblings, 2 replies; 6+ messages in thread

From: Tsirkin Evgeny @ 2004-08-23 13:21 UTC (permalink / raw)
  To: pgsql-admin

Hi all!
I am using 7.3.4 
while executing psql -c the query is not commited
that is probably because i have setted the autocommit = false
However that is very unheandy - i have to add begin and 
commit to my shell scripts.I beleave that automatically
commiting the psql -c queries is very logical thing.
Is there a way to avoid this ?
If that is not changed in 7.4  maybe it should be in 
future versions?
Thanks.

-- 
Evgeny.



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: psql and autocommit
@ 2004-08-23 13:40  Radu-Adrian Popescu <radu.popescu@aldratech.com>
  parent: Tsirkin Evgeny <tsurkin@mail.jct.ac.il>
  1 sibling, 2 replies; 6+ messages in thread

From: Radu-Adrian Popescu @ 2004-08-23 13:40 UTC (permalink / raw)
  To: pgsql-admin; +Cc: Tsirkin Evgeny <tsurkin@mail.jct.ac.il>

Tsirkin Evgeny wrote:
[snip]
> commit to my shell scripts.I beleave that automatically
> commiting the psql -c queries is very logical thing.

I'm sure there are people who disagree with that statement. For instance 
Oracle's sqlplus starts in noautocommit by default. And I've found that to be a 
good thing actually.
For what it's worth I also think default client policy may as well be left 
unchanged, or there will be a lot of baffled people.

Regards,
-- 
Radu-Adrian Popescu
CSA, DBA, Developer
Aldrapay MD
Aldratech Ltd.
+40213212243




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: psql and autocommit
@ 2004-08-23 13:48  Tsirkin Evgeny <tsurkin@mail.jct.ac.il>
  parent: Radu-Adrian Popescu <radu.popescu@aldratech.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Tsirkin Evgeny @ 2004-08-23 13:48 UTC (permalink / raw)
  To: Radu-Adrian Popescu <radu.popescu@aldratech.com>; +Cc: pgsql-admin

On Mon, 23 Aug 2004, Radu-Adrian Popescu wrote:

> Tsirkin Evgeny wrote:
> [snip]
> > commit to my shell scripts.I beleave that automatically
> > commiting the psql -c queries is very logical thing.
> 
> I'm sure there are people who disagree with that statement. For instance 
> Oracle's sqlplus starts in noautocommit by default. And I've found that to be a 
> good thing actually.
Probably a metter of taste.
> For what it's worth I also think default client policy may as well be left 
> unchanged, or there will be a lot of baffled people.
You are right.But there is no even a simple flag for psql 
that will tell it to do autocommit!(maybe i will manage to use -set 
but i don't know how for now).
> 
> Regards,
> 

-- 
Evgeny.



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: psql and autocommit
@ 2004-08-23 18:53  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Tsirkin Evgeny <tsurkin@mail.jct.ac.il>
  1 sibling, 0 replies; 6+ messages in thread

From: Tom Lane @ 2004-08-23 18:53 UTC (permalink / raw)
  To: Tsirkin Evgeny <tsurkin@mail.jct.ac.il>; +Cc: pgsql-admin

Tsirkin Evgeny <tsurkin@mail.jct.ac.il> writes:
> I am using 7.3.4 
> while executing psql -c the query is not commited
> that is probably because i have setted the autocommit = false
> However that is very unheandy - i have to add begin and 
> commit to my shell scripts.

You have found one of the reasons we decided server-side autocommit was
evil ...

> Is there a way to avoid this ?

Use 7.4.  Note that autocommit is a psql feature not a server setting
in 7.4.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: psql and autocommit
@ 2004-08-24 08:17  Stephen Kennedy <skennedy@tissat.es>
  parent: Radu-Adrian Popescu <radu.popescu@aldratech.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Stephen Kennedy @ 2004-08-24 08:17 UTC (permalink / raw)
  To: pgsql-admin

Just a note to clarify sqlplus

It does start in noautocommit as you say.
However,  it issues a commit when you exit (with quit, Ctrl-D or whatever) 
which is (in my opinion) incorrect, and very much worth taking into account
when writing scripts for Oracle.
I think it should automatically issue a rollback on exit.

regards,

Stephen.

Radu-Adrian Popescu wrote:

> Tsirkin Evgeny wrote:
> [snip]
>
>> commit to my shell scripts.I beleave that automatically
>> commiting the psql -c queries is very logical thing.
>
>
> I'm sure there are people who disagree with that statement. For 
> instance Oracle's sqlplus starts in noautocommit by default. And I've 
> found that to be a good thing actually.
> For what it's worth I also think default client policy may as well be 
> left unchanged, or there will be a lot of baffled people.
>
> Regards,





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: psql and autocommit
@ 2004-08-24 08:28  Tsirkin Evgeny <tsurkin@mail.jct.ac.il>
  parent: Stephen Kennedy <skennedy@tissat.es>
  0 siblings, 0 replies; 6+ messages in thread

From: Tsirkin Evgeny @ 2004-08-24 08:28 UTC (permalink / raw)
  To: Stephen Kennedy <skennedy@tissat.es>; +Cc: pgsql-admin

On Tue, 24 Aug 2004, Stephen Kennedy wrote:
You are all right .However i was talking about the writing
shell scripts and running 
psql -c 
from it .THIS is a big problem if no autocommit is setted on 
since at the end of the psql -c command there is a disconnect
and you have to add a commit to it BEFOR this disconnect.very 
unhandy .
However i understood from Tom that this is solved in 7.4 ,
just not yet ready to switch to it from my 7.3 server.
Thanks
> Just a note to clarify sqlplus
> 
> It does start in noautocommit as you say.
> However,  it issues a commit when you exit (with quit, Ctrl-D or whatever) 
> which is (in my opinion) incorrect, and very much worth taking into account
> when writing scripts for Oracle.
> I think it should automatically issue a rollback on exit.
> 
> regards,
> 
> Stephen.
> 
> Radu-Adrian Popescu wrote:
> 
> > Tsirkin Evgeny wrote:
> > [snip]
> >
> >> commit to my shell scripts.I beleave that automatically
> >> commiting the psql -c queries is very logical thing.
> >
> >
> > I'm sure there are people who disagree with that statement. For 
> > instance Oracle's sqlplus starts in noautocommit by default. And I've 
> > found that to be a good thing actually.
> > For what it's worth I also think default client policy may as well be 
> > left unchanged, or there will be a lot of baffled people.
> >
> > Regards,
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
> 

-- 
Evgeny.



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2004-08-24 08:28 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-08-23 13:21 psql and autocommit Tsirkin Evgeny <tsurkin@mail.jct.ac.il>
2004-08-23 13:40 ` Radu-Adrian Popescu <radu.popescu@aldratech.com>
2004-08-23 13:48   ` Tsirkin Evgeny <tsurkin@mail.jct.ac.il>
2004-08-24 08:17   ` Stephen Kennedy <skennedy@tissat.es>
2004-08-24 08:28     ` Tsirkin Evgeny <tsurkin@mail.jct.ac.il>
2004-08-23 18:53 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox