Hey, I just found that if I "BEGIN", making a lot of inserts (1000) and on
1001 insert I get an error (for example "duplicate key") ALL prev 1000
insertes I LOST.
Give me please author of this %$%$^&%# idea!!! It's really STUPID.

Andriy Korud, Lviv, Ukraine
P.S. Sorry for this letter but I'm really angy. Can postgres give me the way
to store uniq data in datable without checking before each insert if this
data alredy exist or no. Why it cannot give me error about duplicate keys
which I will (or will not) take in care.


1 Nov 1999 17:09:15 +0200
"Andrij Korud" <akorud@polynet.lviv.ua>
Whos idea was this
Andrij Korud writes:
 > Hey, I just found that if I "BEGIN", making a lot of inserts (1000) and on
 > 1001 insert I get an error (for example "duplicate key") ALL prev 1000
 > insertes I LOST.
 > Give me please author of this %$%$^&%# idea!!! It's really STUPID.


Actually, that's the way it's supposed to work.  Most modern
relational databases support what are called transactions.  A
transaction is an indivisible unit of work for the database engine.

By starting a transaction (using the 'BEGIN') you are telling the
database engine that you want it to make the updates if and only if
_all_ of the updates can succeed.  If any updates that will fail the
database engine will make sure that none of the updates take place.

Transactions come in really handy if we have updates on a set of mutually
dependent tables.  Frequently we don't want to update any of the
tables unless we can sucdeed in updating all of the tables.

If you have a set of updates that aren't mutually dependent, just use
a 'COMMIT TRANSACTION' between each update.


-- 
=======================================================================
 Life is short.                  | Craig Spannring 
      Bike hard, ski fast.       | Craig.Spannring@aedinc.net
 --------------------------------+------------------------------------
 Any sufficiently horrible technology is indistinguishable from Perl.
=======================================================================


Mon, 1 Nov 1999 10:17:42 -0700 (MST)
Craig Spannring <Craig.Spannring@aedinc.net>
Re: [HACKERS] Whos idea was this
Sorry for first angry letter and let close this theme.
Sorry once more.

Andriy Korud, Lviv, Ukraine


1 Nov 1999 19:20:01 +0200
"Andrij Korud" <akorud@polynet.lviv.ua>
Re: [HACKERS] Whos idea was this