Re: [GENERAL] Trouble with Savepoints in postgres

2008-03-15 Thread sam
On Mar 12, 3:31 pm, sam [EMAIL PROTECTED] wrote: On Mar 12, 8:11 am, [EMAIL PROTECTED] (Alvaro Herrera) wrote: Please always ensure that the list is copied on replies (use Reply to all) so that other people can help you. sam escribió: On Mar 11, 5:39 pm, [EMAIL PROTECTED] (Alvaro

Re: [GENERAL] Trouble with Savepoints in postgres

2008-03-15 Thread Tom Lane
sam [EMAIL PROTECTED] writes: Ok i realised that the only way data can be committed within a procedure is to use nested BEGIN..END. Nothing that you said in this message is correct. You can't commit anything within a function, and bare BEGIN/END don't do anything at all except create a

Re: [GENERAL] Trouble with Savepoints in postgres

2008-03-15 Thread Craig Ringer
sam wrote: FUNCTION UPDATE () BEGIN UPDATE statement EXCEPTION END when one record fails data only for that is rolled back the rest of the data is saved. EXCEPTION has to be caught. As I recently found out, too many savepoints really kill PostgreSQL's performance in a transaction. A

Re: [GENERAL] Trouble with Savepoints in postgres

2008-03-12 Thread Alvaro Herrera
Please always ensure that the list is copied on replies (use Reply to all) so that other people can help you. sam escribió: On Mar 11, 5:39 pm, [EMAIL PROTECTED] (Alvaro Herrera) wrote: sam escribió: Iam not able to understand if this is a version problem or the way iam using

Re: [GENERAL] Trouble with Savepoints in postgres

2008-03-12 Thread sam
On Mar 12, 8:11 am, [EMAIL PROTECTED] (Alvaro Herrera) wrote: Please always ensure that the list is copied on replies (use Reply to all) so that other people can help you. sam escribió: On Mar 11, 5:39 pm, [EMAIL PROTECTED] (Alvaro Herrera) wrote: sam escribió: Iam not able to

[GENERAL] Trouble with Savepoints in postgres

2008-03-11 Thread sam
Iam not able to use savepoints i postgres. Iam using version 8.2. If i write something like this : CREATE OR REPLACE FUNCTION test_savepoint() RETURNS void AS $BODY$ DECLARE BEGIN SAVEPOINT foo; INSERT INTO table1 VALUES (3); INSERT INTO table1 VALUES (4); ROLLBACK TO foo; COMMIT;

Re: [GENERAL] Trouble with Savepoints in postgres

2008-03-11 Thread Alvaro Herrera
sam escribió: Iam not able to understand if this is a version problem or the way iam using savepoints is wrong.Please advice. It is. You cannot use savepoints in PL/pgSQL functions (or any function for that matter). You can use EXCEPTION clauses instead. -- Alvaro Herrera