A few more points...
In PostgreSQL, transactions are generally all or nothing. Note that with version 8.0 and above, you have save points. You can use these to roll back part of a transaction to it's previous state. For instance, in the older versions (7.4 and before) if you did this:
begin;
insert into tablea ...
insert into tableb ...
insert into tablec ... <-- get an error here
rollback / commit;
the whole transaction will be rolled back, no way around it. Using rollback or commit would make no difference, as you got an error.
With the newer version, you can do something like:
begin;
insert into tablea ...
insert into tableb ...
savepoint backhere;
insert into tablec ... <-- get an error here
(in php: )
if error then "rollback to backhere", execute update instead of insert
commit;
See this page for information on savepoints:
http://www.postgresql.org/docs/8.1/interactive/sql-savepoint.html