Thread: UPDATE after Cancle

UPDATE after Cancle

From
David Kerr
Date:
Howdy all -

I just got this odd behavior in my system.

This is PG 8.3.10 on RedHat 5.4

psql bla
bla=# update blatab set blafield = replace(blafield,'XXX-1','XXX1-')
where created_by = 'blauser';

<runs for a while>
<dave hit's ctl-c becuase i messed up the substitution value >

Cancel request sent
UPDATE 8231584

I checked and the updated did happen.

autocommit is on, and i wasn't in a TX or anything strange like that.

My guess is that i hit ctl-c during the commit of the data and it wasn't
able to rollback.

Any idea if that's the case? and if so, is that expected?

Thanks

Dave

Re: UPDATE after Cancle

From
"Joshua D. Drake"
Date:
On Wed, 2010-06-23 at 13:05 -0700, David Kerr wrote:
> Howdy all -
>
> I just got this odd behavior in my system.
>
> This is PG 8.3.10 on RedHat 5.4
>
> psql bla
> bla=# update blatab set blafield = replace(blafield,'XXX-1','XXX1-')
> where created_by = 'blauser';
>
> <runs for a while>
> <dave hit's ctl-c becuase i messed up the substitution value >
>
> Cancel request sent
> UPDATE 8231584
>
> I checked and the updated did happen.
>
> autocommit is on, and i wasn't in a TX or anything strange like that.
>
> My guess is that i hit ctl-c during the commit of the data and it wasn't
> able to rollback.
>
> Any idea if that's the case? and if so, is that expected?

It finished before it received the cancellation. You need to be using
transactions.

Joshua D. Drake

>
> Thanks
>
> Dave
>

--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering

Re: UPDATE after Cancle

From
"Joshua D. Drake"
Date:
On Wed, 2010-06-23 at 13:05 -0700, David Kerr wrote:
> Howdy all -
>
> I just got this odd behavior in my system.
>
> This is PG 8.3.10 on RedHat 5.4
>
> psql bla
> bla=# update blatab set blafield = replace(blafield,'XXX-1','XXX1-')
> where created_by = 'blauser';
>
> <runs for a while>
> <dave hit's ctl-c becuase i messed up the substitution value >
>
> Cancel request sent
> UPDATE 8231584
>
> I checked and the updated did happen.
>
> autocommit is on, and i wasn't in a TX or anything strange like that.
>
> My guess is that i hit ctl-c during the commit of the data and it wasn't
> able to rollback.
>
> Any idea if that's the case? and if so, is that expected?

It finished before it received the cancellation. You need to be using
transactions.

Joshua D. Drake

>
> Thanks
>
> Dave
>

--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering