agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
Line number returned in Postgres Raise Exception sentence
3+ messages / 2 participants
[nested] [flat]

* Line number returned in Postgres Raise Exception sentence
@ 2017-11-14 10:17  queralt <queraltr@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: queralt @ 2017-11-14 10:17 UTC (permalink / raw)
  To: pgsql-sql

We are migrating a system from Postgres 9.2 to Postgres 9.6.

The problem is that in migrating the Stored Procedures, where we use the
RAISE EXCEPTION sentence, a new line is added in the message returned when
there is a RAISE EXCEPTION.  In our system the existence of this second part
of the message is a big problem.

"ERROR: Message of Error
SQL state: P0001
Context: function PL/pgSQL xxx() in line 4 of RAISE"

We are executing stored procedures from JDBC and obtain the message with
getMessage and from PgAdmin III or IV.

We would like to know if there is the possibility to configure Postgres 9.6
in order this part of the message does not appear. Or maybe if it is
possible to set some attribute during the database connection.

We have read about a solution changing in the file postgres.config the
attribute log_error_verbosity to terse. We did but it has no effect in the
result.




--
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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Line number returned in Postgres Raise Exception sentence
@ 2017-11-15 08:49  Pavel Stehule <pavel.stehule@gmail.com>
  parent: queralt <queraltr@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Pavel Stehule @ 2017-11-15 08:49 UTC (permalink / raw)
  To: queralt <queraltr@gmail.com>; +Cc: pgsql-sql

Hi

2017-11-14 11:17 GMT+01:00 queralt <queraltr@gmail.com>:

> We are migrating a system from Postgres 9.2 to Postgres 9.6.
>
> The problem is that in migrating the Stored Procedures, where we use the
> RAISE EXCEPTION sentence, a new line is added in the message returned when
> there is a RAISE EXCEPTION.  In our system the existence of this second
> part
> of the message is a big problem.
>
> "ERROR: Message of Error
> SQL state: P0001
> Context: function PL/pgSQL xxx() in line 4 of RAISE"
>
> We are executing stored procedures from JDBC and obtain the message with
> getMessage and from PgAdmin III or IV.
>
> We would like to know if there is the possibility to configure Postgres 9.6
> in order this part of the message does not appear. Or maybe if it is
> possible to set some attribute during the database connection.
>
> We have read about a solution changing in the file postgres.config the
> attribute log_error_verbosity to terse. We did but it has no effect in the
> result.
>
>
This filtering is client side task

https://www.postgresql.org/docs/current/static/libpq-control.html

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=0426f349effb6bde2061f3398a71db718...

So this should be changed by some JDBC setup if it is possible

Regards

Pavel





>
>
> --
> 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
>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Line number returned in Postgres Raise Exception sentence
@ 2017-11-20 12:52  queralt <queraltr@gmail.com>
  parent: Pavel Stehule <pavel.stehule@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: queralt @ 2017-11-20 12:52 UTC (permalink / raw)
  To: 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


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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2017-11-20 12:52 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-11-14 10:17 Line number returned in Postgres Raise Exception sentence queralt <queraltr@gmail.com>
2017-11-15 08:49 ` Pavel Stehule <pavel.stehule@gmail.com>
2017-11-20 12:52   ` queralt <queraltr@gmail.com>

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