गलतियों से निपटना

PostgreSQL में Transactions और Error Handling

Jason Myers

Principal Engineer

गलतियाँ होती हैं

गलती से Biscuits अपडेट कर दिया

UPDATE cookies SET quantity = 13 WHERE name = 'Biscuits';

सही करके Biscotti अपडेट किया

UPDATE cookies SET quantity = 1 WHERE name = 'Biscuits';

UPDATE cookies SET quantity = 13 WHERE name = 'Biscotti';
PostgreSQL में Transactions और Error Handling

गलतियाँ रोलबैक करना

BEGIN TRANSACTION

UPDATE cookies SET quantity = 13 WHERE name = 'Biscuits';
ROLLBACK;
SELECT quantity FROM cookies where name = 'Biscuits';
13
PostgreSQL में Transactions और Error Handling

कई स्टेटमेंट्स को रोलबैक करें

BEGIN TRANSACTION;

UPDATE cookies SET deliciousness = 111 where name = 'Cats Tongue';

UPDATE cookies SET deliciousness = 8 where name = 'Gingerbread';

ROLLBACK;
SELECT name, deliciousness FROM cookies where name in ('Cats Tongue', 'Gingerbread');
'Cats Tongue'  10
'Gingerbread'   9
PostgreSQL में Transactions और Error Handling

अभ्यास करते हैं!

PostgreSQL में Transactions और Error Handling

Preparing Video For Download...