Search Postgresql Archives

Re: transaction problem using cursors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Monday 11 June 2007 13:45, Pit M. wrote:
| Assume a user doing a query which shall select all customers having a
| ZIP in [10000;20000[ by using a CAST. If the cursor now fetches the row
| with ID 4 we get an error (invalid input syntax) as "A1234" cannot be
| casted as integer. This is ok, BUT now all further FETCH commands fail
| with "current transaction is aborted"!
|
| How can we resume from there with FETCH commands (e.g. at least FETCH
| FIRST)? We cannot avoid the (first) error itself, as the user can enter
| any WHERE condition at runtime. Therefore we must handle the error - if
| any - and resume from there properly.

I didn't try myself, but wrapping the whole into a PL/pgSQL function and
using exceptions might do the work;

http://www.postgresql.org/docs/8.2/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING

Ciao,
Thomas

-- 
Thomas Pundt <thomas.pundt@xxxxxxxxxxxx> ---- http://rp-online.de/ ----


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux