Re: [GENERAL] How to stop implicit rollback on certain errors? - Mailing list pgsql-general

From Lincoln Yeoh
Subject Re: [GENERAL] How to stop implicit rollback on certain errors?
Date
Msg-id 3.0.5.32.19991208172243.008d8b10@pop.mecomb.po.my
Whole thread Raw
In response to Increasing size of BLCKSZ  (Daniel Stolk <stolkd@email.com>)
Responses Re: [GENERAL] How to stop implicit rollback on certain errors?
List pgsql-general
Hi,

Say I have a transaction which goes like this:

begin;
insert into stuff;
do some nondatabase things based on last inserted id;
update a date in stuff;
commit;

It seems that if the date is out of the database range, everything is
thrown out. Is it possible to catch the database error and use a null date
instead, without throwing everything away?

Right now I only have two ways of proceeding:
1) commit before trying to update the date. And if things still don't work
- database has some non date related error, try to delete the previously
inserted stuff.
2) Make sure the dates are nice before trying to stick them in.

Unless there are I'll have to do 2).

Inserting stuff like
'27 Oct 19999 18:21:00 +0800' causes errors even though datetime supposedly
handles dates up to 1465001 AD.

I guess that's expected, and I should insert big years using another less
ambiguous format. What is the recommended format?

Thanks,

Link.


pgsql-general by date:

Previous
From: "neil d. quiogue"
Date:
Subject: REPLICATION
Next
From: "Martin Stanek"
Date:
Subject: foreign key