Hello all, This question refers to version 9.4 of Postgres. I have have a function
Datum do_something(PG_FUNCTION_ARGS) { ... if(error_occured) { ereport(ERROR, (errmsg("some error occured"))); } ... } When I call do_something in a way to deliberately cause the error condition, the client connection (psql) is terminated, however for example when you say (or many other function calls that cause ereport to be called): psql > SELECT ST_IsSimple('POINT(1, 1)'); I simply get the message "ERROR: parse error - invalid geometry" but the connection is not closed. The subqueries also know that the inner query had terminated with an error somehow, without terminating the connection: psql> select * from (select st_issimple('point(0, 0)')) as a; ERROR: parse error - invalid geometry I guess this could be done with surrounding the function call with PG_TRY/CATCH however these macros are not present in Postgis code. Can you please suggest how to implement this functionality in my code? Thanks, Igor