No title

Started by surabhi.ahujaabout 21 years ago5 messagesgeneral
Jump to latest
#1surabhi.ahuja
surabhi.ahuja@iiitb.ac.in

in a transaction i try to insert into a table1, followed by insert into table 2 then insert into table 3 and last insert into table 4. However if a unique key violation occurs in the table 1 , the whole trabnsaction aborts. is there no way , where i can ignore this violation, and continue with the remaining insertions.
?

#2Jan Poslusny
pajout@gingerall.cz
In reply to: surabhi.ahuja (#1)
Re:

You can use savepoints in pg 8.0:
http://www.postgresql.org/docs/8.0/static/sql-savepoint.html

Surabhi Ahuja wrote:

Show quoted text

in a transaction i try to insert into a table1, followed by insert
into table 2 then insert into table 3 and last insert into table 4.
However if a unique key violation occurs in the table 1 , the whole
trabnsaction aborts. is there no way , where i can ignore this
violation, and continue with the remaining insertions.
?

#3surabhi.ahuja
surabhi.ahuja@iiitb.ac.in
In reply to: Jan Poslusny (#2)
Re:

cant the same be done by trapping the errors. by trapping these exceptions?
http://www.postgresql.org/docs/8.0/interactive/plpgsql-control-structures.html

search for "trapping errors" ?

________________________________

From: Jan Poslusny [mailto:pajout@gingerall.cz]
Sent: Tue 2/8/2005 3:30 PM
To: Surabhi Ahuja
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL]

***********************
Your mail has been scanned by InterScan VirusWall.
***********-***********

You can use savepoints in pg 8.0:
http://www.postgresql.org/docs/8.0/static/sql-savepoint.html

Surabhi Ahuja wrote:

Show quoted text

in a transaction i try to insert into a table1, followed by insert
into table 2 then insert into table 3 and last insert into table 4.
However if a unique key violation occurs in the table 1 , the whole
trabnsaction aborts. is there no way , where i can ignore this
violation, and continue with the remaining insertions.
?

#4Jan Poslusny
pajout@gingerall.cz
In reply to: surabhi.ahuja (#3)
Re:

If you want to realize your insert chain in plpgsql, trapping exceptions
is a good idea, imho. But I am not experienced with these new features
in pg 8.0 ...

Surabhi Ahuja wrote:

Show quoted text

cant the same be done by trapping the errors. by trapping these
exceptions?
http://www.postgresql.org/docs/8.0/interactive/plpgsql-control-structures.html

search for "trapping errors" ?

------------------------------------------------------------------------
*From:* Jan Poslusny [mailto:pajout@gingerall.cz]
*Sent:* Tue 2/8/2005 3:30 PM
*To:* Surabhi Ahuja
*Cc:* pgsql-general@postgresql.org
*Subject:* Re: [GENERAL]

***********************
Your mail has been scanned by InterScan VirusWall.
***********-***********

You can use savepoints in pg 8.0:
http://www.postgresql.org/docs/8.0/static/sql-savepoint.html

Surabhi Ahuja wrote:

in a transaction i try to insert into a table1, followed by insert
into table 2 then insert into table 3 and last insert into table 4.
However if a unique key violation occurs in the table 1 , the whole
trabnsaction aborts. is there no way , where i can ignore this
violation, and continue with the remaining insertions.
?

#5Shaun Clements
ShaunC@relyant.co.za
In reply to: Jan Poslusny (#4)
Re:

You would need to use EXCEPTION, to trap the error.

Kind Regards,
Shaun Clements

-----Original Message-----
From: Jan Poslusny [mailto:pajout@gingerall.cz]
Sent: 08 February 2005 12:01 PM
To: Surabhi Ahuja
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL]

You can use savepoints in pg 8.0:
http://www.postgresql.org/docs/8.0/static/sql-savepoint.html

Surabhi Ahuja wrote:

in a transaction i try to insert into a table1, followed by insert
into table 2 then insert into table 3 and last insert into table 4.
However if a unique key violation occurs in the table 1 , the whole
trabnsaction aborts. is there no way , where i can ignore this
violation, and continue with the remaining insertions.
?

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
Subject to www.relyant.co.za/edisclaim.htm