agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: queralt <queraltr@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: Line number returned in Postgres Raise Exception sentence
Date: Mon, 20 Nov 2017 05:52:21 -0700 (MST)
Message-ID: <1511182341138-0.post@n3.nabble.com> (raw)
In-Reply-To: <CAFj8pRDY5s3itezU9r4Y6TAh+NPGxLjMmnTZgaeq6ibpXfy2wg@mail.gmail.com>
References: <1510654656203-0.post@n3.nabble.com>
	<CAFj8pRDY5s3itezU9r4Y6TAh+NPGxLjMmnTZgaeq6ibpXfy2wg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (3+ messages)

Message-ID: <1511182341138-0.post@n3.nabble.com>
Permalink:  ../1511182341138-0.post@n3.nabble.com/
Also on:    postgresql.org/message-id/1511182341138-0.post@n3.nabble.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: queraltr@gmail.com
  Subject: Re: Line number returned in Postgres Raise Exception sentence
  In-Reply-To: <1511182341138-0.post@n3.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox