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

Re: Minor question

From: Phillip Smith <phillip(dot)smith(at)weatherbeeta(dot)com(dot)au>
To: Jan Danielsson <jan(dot)m(dot)danielsson(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Minor question
Date: 2007-03-09 10:12:20
Message-ID: 1173435140.5301.5.camel@it-laptop (view raw or flat)
Thread:
Lists: pgsql-novice
I don't believe it would make any difference... NOT doing the rollback
would maybe save a couple of CPU cycles, but unless you're trying to
squeeze EVERY, LAST cycle out of your CPU, I wouldn't bother... 

What's the underlying reason you're asking?

Cheers,
~p

On Fri, 2007-03-09 at 11:03 +0100, Jan Danielsson wrote:

> Hello all,
> 
>    If I perform an update on a table which doesn't contain any rows to
> update, should I perform a rollback? I realize that the transaction is
> lost when the connection is closed, but is it technically correct to do so?
> 
>    I have this (psudo code):
> 
> -------------------------
> UPDATE sessions SET last_access=current_time WHERE id='foo'
> 
> if crsr.rowcount == 1:
>    conn.commit()
> else
>    # No entries found
>    conn.rollback()
> -------------------------
> 

Phillip Smith
IT Coordinator
Weatherbeeta P/L
8 Moncrief Rd
Nunawading, Vic, 3131
AUSTRALIA

P. +613 9845 0600
F. +613 9845 0655
E. phillip(dot)smith(at)weatherbeeta(dot)com(dot)au

In response to

pgsql-novice by date

Next:From: Phillip SmithDate: 2007-03-09 10:13:27
Subject: Re: PostgreSQL and import/export to dbf and mdb
Previous:From: Jan DanielssonDate: 2007-03-09 10:03:12
Subject: Minor question

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