Re: [GENERAL] How to stop implicit rollback on certain errors?

From: Lincoln Yeoh <lylyeoh(at)mecomb(dot)com>
To: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] How to stop implicit rollback on certain errors?
Date: 1999-12-08 09:22:43
Message-ID: 3.0.5.32.19991208172243.008d8b10@pop.mecomb.po.my
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message davidb 1999-12-08 15:13:11 Re: [GENERAL] ODBC Drivers for Win
Previous Message neil d. quiogue 1999-12-08 08:44:41 REPLICATION