Home > Archive > PostgreSQL JDBC > July 2005 > Proposed patch for showing originating query on error









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Proposed patch for showing originating query on error
Dave Cramer

2005-07-28, 9:24 am

This just adds an exception to the existing backend exception showing
the originating query.

Given that the backend doesn't show us this information, a few people
have asked for it.

Dave

*** 426,437 ****
--- 432,451 ----

StatementResultHandl
er handler = new StatementResultHandl
er
();
result = null;
+ try
+ {
connection.getQueryExecutor(). execute(queryToExecu
te,
queryParameters,
handler,
maxrows,
fetchSize,
flags);
+ }
+ catch( SQLException ex )
+ {
+ handler.handleError(new PSQLException(GT.tr("Original
Query -->") + queryToExecute. toString(queryParame
ters),
PSQLState.UNKNOWN_ST
ATE));
+ throw ex;
+ }
result = firstUnclosedResult = handler.getResults();
}



---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Oliver Jowett

2005-07-28, 9:24 am

Dave Cramer wrote:

> *** 426,437 ****
> --- 432,451 ----


Uh, what file is this a patch to?

-O


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Dave Cramer

2005-07-28, 9:24 am

AbstractJdbc2Stateme
nt.java

On 28-Jul-05, at 10:22 AM, Oliver Jowett wrote:

> Dave Cramer wrote:
>
>
>
> Uh, what file is this a patch to?
>
> -O
>
>
>



---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Oliver Jowett

2005-07-28, 9:24 am

Dave Cramer wrote:
> This just adds an exception to the existing backend exception showing
> the originating query.


I think the basic idea is ok, but..

- this should be on the original exception, not on a chained synthetic
exception
- doing it only in execute() seems incomplete, there are other query
execution paths, perhaps this logic belongs somewhere in the query executor?
- ideally it should be configurable (hook it into whatever came out of
Kris' suggestions about including more info in server-generated
exception, perhaps?)

-O

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Dave Cramer

2005-07-28, 9:24 am


On 28-Jul-05, at 10:46 AM, Oliver Jowett wrote:

> Dave Cramer wrote:
>
>
> I think the basic idea is ok, but..
>
> - this should be on the original exception, not on a chained synthetic
> exception

Yeah, that would be cleaner.
> - doing it only in execute() seems incomplete, there are other query
> execution paths, perhaps this logic belongs somewhere in the query
> executor?


There are even more paths there to hook into. Putting it in
AbstractJdbc2Stateme
nt minimizes
the number of places it would need to be added to. QueryExecutor has
a few Implementations ...

> - ideally it should be configurable (hook it into whatever came out of
> Kris' suggestions about including more info in server-generated
> exception, perhaps?)

Well, lets get it working first before we make it configurable.
>
> -O
>
>



---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Oliver Jowett

2005-07-28, 11:36 am

Dave Cramer wrote:

> There are even more paths there to hook into. Putting it in
> AbstractJdbc2Stateme
nt minimizes
> the number of places it would need to be added to. QueryExecutor has a
> few Implementations ...


Well, do you have a better suggestion that catches all paths?

>
> Well, lets get it working first before we make it configurable.


sigh :( let's get it right before we commit it at all.. in practise it
seems "we'll fix this later" means "we won't fix it"

-O

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Dave Cramer

2005-07-28, 11:36 am


On 28-Jul-05, at 11:06 AM, Oliver Jowett wrote:

> Dave Cramer wrote:
>
>
>
> Well, do you have a better suggestion that catches all paths?

I'll give it some serious attention later, I hacked it in to your
code for someone, just wanted to get it into the discussion.
>
>
>
> sigh :( let's get it right before we commit it at all.. in practise it
> seems "we'll fix this later" means "we won't fix it"

Agreed.
>
> -O
>
>



---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com