Re: [HACKERS] Whos idea was this
От | Craig Spannring |
---|---|
Тема | Re: [HACKERS] Whos idea was this |
Дата | |
Msg-id | 199911011717.KAA17268@kampong.aedinc.net обсуждение исходный текст |
Ответ на | Whos idea was this ("Andrij Korud" <akorud@polynet.lviv.ua>) |
Ответы |
Re: [HACKERS] Whos idea was this
|
Список | pgsql-hackers |
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 reallySTUPID. 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--------------------------------+------------------------------------Anysufficiently horrible technologyis indistinguishable from Perl. =======================================================================
В списке pgsql-hackers по дате отправления: