[postgis-users] Exception Handling in Postgis function

Sandro Santilli strk at keybit.net
Sun Nov 15 23:52:44 PST 2015


On Fri, Nov 13, 2015 at 06:17:56PM -0800, ranjitsaurav wrote:

> ERROR:  Edge intersects (not on endpoints) with existing edge 162 at or near
> point POINT(100.3812061 13.6915724)
> 
> I would like to implement exception handling so that I could know from which
> line of table "clip_linestring" this error is coming. I would like to know
> the row in the table from which the error is being generated.
> 
> How do I use the exception handling for these kind of issue.

In plpgsql you'd use a block like this:

  BEGIN
    SELECT possiblyThrowingFunction();
  EXCEPTION
    WHEN OTHERS THEN
      msg := SQLERRM;
  END

--strk;


More information about the postgis-users mailing list