pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
disable auto-commit
7+ messages / 7 participants
[nested] [flat]

* disable auto-commit
@ 2000-08-28 12:59  HENAFF Mari-mai FTRD/DMI/LAN <marimai.henaff@rd.francetelecom.fr>
  0 siblings, 1 reply; 7+ messages in thread

From: HENAFF Mari-mai FTRD/DMI/LAN @ 2000-08-28 12:59 UTC (permalink / raw)
  To: pgsql-admin

Hi,

How do I disable auto-commit with Postgres ?

Thanks,
M. Henaff




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

* RE: disable auto-commit
@ 2000-09-04 16:33  Rafa Couto <rcouto@pascualsilva.com>
  parent: HENAFF Mari-mai FTRD/DMI/LAN <marimai.henaff@rd.francetelecom.fr>
  0 siblings, 0 replies; 7+ messages in thread

From: Rafa Couto @ 2000-09-04 16:33 UTC (permalink / raw)
  To: HENAFF Mari-mai FTRD/DMI/LAN <marimai.henaff@rd.francetelecom.fr>; pgsql-admin


> How do I disable auto-commit with Postgres ?

Just do not BEGIN transaction...






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

* disable auto-commit
@ 2000-10-25 10:38  Joel Pang <joelpang@spectratech.com>
  0 siblings, 2 replies; 7+ messages in thread

From: Joel Pang @ 2000-10-25 10:38 UTC (permalink / raw)
  To: pgsql-admin

In psql, once I delete an entry, it's gone permanently.  How do I disable
such auto-commit behavior?




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

* Re: disable auto-commit
@ 2000-10-26 16:53  Alfred Perlstein <bright@wintelcom.net>
  parent: Joel Pang <joelpang@spectratech.com>
  1 sibling, 0 replies; 7+ messages in thread

From: Alfred Perlstein @ 2000-10-26 16:53 UTC (permalink / raw)
  To: Joel Pang <joelpang@spectratech.com>; +Cc: pgsql-admin

* Joel Pang <joelpang@spectratech.com> [001026 04:27] wrote:
> In psql, once I delete an entry, it's gone permanently.  How do I disable
> such auto-commit behavior?


by beginning a transaction, just type:

"BEGIN;"

then with 'COMMIT;' (to commit) or 'ROLLBACK' (to rollback).


-- 
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."



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

* Re: disable auto-commit
@ 2000-10-26 19:30  John McKown <joarmc@swbell.net>
  parent: Joel Pang <joelpang@spectratech.com>
  1 sibling, 1 reply; 7+ messages in thread

From: John McKown @ 2000-10-26 19:30 UTC (permalink / raw)
  To: Joel Pang <joelpang@spectratech.com>; +Cc: pgsql-admin

Well, you could start a transaction. But the record will be deleted once
you do a COMMIT. Is that what you want? If you want some way to
"delete" an entry, but then to later "undelete" it, there really isn't a
way. I have heard of other systems where things were "logically deleted",
but recoverable until a "purge" command was done. PostgreSQL does not have
this type of behaviour.

John

On Wed, 25 Oct 2000, Joel Pang wrote:

> In psql, once I delete an entry, it's gone permanently.  How do I disable
> such auto-commit behavior?
> 




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

* Re: disable auto-commit
@ 2000-10-27 10:14  Jacopo Silva <jacoposilva@tin.it>
  parent: John McKown <joarmc@swbell.net>
  0 siblings, 1 reply; 7+ messages in thread

From: Jacopo Silva @ 2000-10-27 10:14 UTC (permalink / raw)
  To: pgsql-admin

If are deleting something, then you probably want delete it...

I mean that the DELETE command phisically removes some
rows from a table, and after the command they are gone forever.


If you want to delete something that can be restored later, then
you are not actually deleting anything, you are just "hiding" from
the user but still keeping in the db.
So what I usually do in this cases is using a boolean field named
"hide" . If the user choose to delete a row I actually put the
"true" value in that field, if I want to restore I can turn back
the field value to "false".

Then I select rows from the table with the "WHERE NOT hide"
clause whenever I don't want the user to see what he "deleted" .

I use to default the field value to "false" so I can forget it and use
it only when I want to hide something. e.g.:
CREATE TABLE foo (
...
...
...
hide bool DEFAULT false);





Commit does not mean much in this contest.  You commit
when you force the operating system to write in the disk any
changes it is storing in memory buffers, when you commit
you flush the cache buffers to the disk.
By default postgresql commit to the disk whenever there is any
change, you can speed up the system by disabling this feature
starting postmaster with "-o -F" .
Anyway even if you do not commit the changes are stored
in the operating system disk cache and you cannot undo them.


Bye,
Jacopo




----- Original Message -----
From: "John McKown" <joarmc@swbell.net>
To: "Joel Pang" <joelpang@spectratech.com>
Cc: <pgsql-admin@postgresql.org>
Sent: Thursday, October 26, 2000 9:30 PM
Subject: Re: [ADMIN] disable auto-commit


> Well, you could start a transaction. But the record will be deleted once
> you do a COMMIT. Is that what you want? If you want some way to
> "delete" an entry, but then to later "undelete" it, there really isn't a
> way. I have heard of other systems where things were "logically deleted",
> but recoverable until a "purge" command was done. PostgreSQL does not have

> this type of behaviour.
>
> John
>
> On Wed, 25 Oct 2000, Joel Pang wrote:
>
> > In psql, once I delete an entry, it's gone permanently.  How do I
disable
> > such auto-commit behavior?
> >
>





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

* Re: disable auto-commit
@ 2000-10-27 22:21  Warren Vanichuk <pyber@street-light.com>
  parent: Jacopo Silva <jacoposilva@tin.it>
  0 siblings, 0 replies; 7+ messages in thread

From: Warren Vanichuk @ 2000-10-27 22:21 UTC (permalink / raw)
  To: pgsql-admin

> Anyway even if you do not commit the changes are stored
> in the operating system disk cache and you cannot undo them.

I disagree, witness the following :

testbunker=> create table temptable (
testbunker->  foo int4,
testbunker->  bar text 
testbunker-> );
CREATE
testbunker=> insert into temptable values ( 1, 'bar' );
INSERT 34605 1
testbunker=> insert into temptable values ( 2, 'baz' );
INSERT 34606 1
testbunker=> insert into temptable values ( 3, 'foo' ); 
INSERT 34607 1
testbunker=> begin;
BEGIN
testbunker=> delete from temptable;
DELETE 3
testbunker=> select * from temptable;
foo|bar
---+---
(0 rows)

testbunker=> rollback;
ABORT
testbunker=> select * from temptable;
foo|bar
---+---
  1|bar
  2|baz
  3|foo
(3 rows)


As you can see, I disabled auto-commit, deleted everything from the table,
confirmed it was gone, then rolled back, and everything was as it was
before.

Sincerely, Warren




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


end of thread, other threads:[~2000-10-27 22:21 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-08-28 12:59 disable auto-commit HENAFF Mari-mai FTRD/DMI/LAN <marimai.henaff@rd.francetelecom.fr>
2000-09-04 16:33 ` Rafa Couto <rcouto@pascualsilva.com>
2000-10-25 10:38 disable auto-commit Joel Pang <joelpang@spectratech.com>
2000-10-26 16:53 ` Alfred Perlstein <bright@wintelcom.net>
2000-10-26 19:30 ` John McKown <joarmc@swbell.net>
2000-10-27 10:14   ` Jacopo Silva <jacoposilva@tin.it>
2000-10-27 22:21     ` Warren Vanichuk <pyber@street-light.com>

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