Thread: Urgent: How to set autocommit off in postgres.........

Urgent: How to set autocommit off in postgres.........

From
"Advid@newgen"
Date:
Hi ,

I read one of solution to andreas problem of how to set autocommit off but
my problem  still persists. I am basically writing a function in plpgsql
language which performs a number of update and insert statements  but on a
failing condition it rollbacks inorder to maintain integrity in the
database. I have tried using the following code :

create function abc() returns char as'
begin
....
begin work;   insert into mytable values(1);   // pseudo code   if (conditions fails) then     rollback work;
end work;
...
..
end;
' language 'plpgsql';

But this code fails miserably by not executing without errors since
autocommit is on.Moreover I could not find  ~/.psqlrc (or /etc/psqlrc).
I am using Red Hat Linux 7.1 and Postgres 7.1.2. I  badly in need of help as
my deadline closes by to submit my project. Hope u would consider this as
SOS call from ur friend.

Waiting in anticipation of early reply,

Regards,
Advid Parmar
New Delhi, India