Re: Line number returned in Postgres Raise Exception sentence

From: queralt <queraltr(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Line number returned in Postgres Raise Exception sentence
Date: 2017-11-20 12:52:21
Message-ID: 1511182341138-0.post@n3.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


We have found another solution from JDBC.
We do a catch of SQLException, then we cast the exception to PSQLException
and then we obtain the ServerErrorMessage.
In this ServerErrorMessage the getMessage() returns just the text of the
error message of the Stored Procedure we execute from the try code.
Previously, we set the server log to Terse (set log_error_verbosity=terse).

catch (SQLException se)
{
System.out.println("ServerErrorMessage");
PSQLException ps = (PSQLException)se;
ServerErrorMessage sem = ps.getServerErrorMessage();
System.out.println(sem.getMessage());
}
}

--
Sent from: http://www.postgresql-archive.org/PostgreSQL-sql-f2142323.html

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stephen Frost 2017-11-20 14:33:05 Migration to pglister - Before
Previous Message Pavel Stehule 2017-11-15 08:49:11 Re: Line number returned in Postgres Raise Exception sentence