Reporting the bind-parameter on an error

Started by Fujii Masaoover 17 years ago2 messageshackers
Jump to latest
#1Fujii Masao
masao.fujii@gmail.com

Hi,

Currently, the SQL statement that causes an error condition is reported
in the server log. On the other hand, the bind-parameter is not reported
as following.

FATAL: terminating connection due to administrator command
STATEMENT: UPDATE tbl SET name = $1 WHERE id = $2
LOG: shutting down

The bind-parameter is useful information for debugging. So, I made
the small patch which reports the bind-parameter together with
the SQL statement on an error.

FATAL: terminating connection due to administrator command
STATEMENT: UPDATE tbl SET name = $1 WHERE id = $2
DETAIL: parameters: $1 = 'hoge', $2 = '1'
LOG: shutting down

Any comments welcome!

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

Attachments:

param_patch.diffapplication/octet-stream; name=param_patch.diffDownload+107-44
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Fujii Masao (#1)
Re: Reporting the bind-parameter on an error

"Fujii Masao" <masao.fujii@gmail.com> writes:

The bind-parameter is useful information for debugging. So, I made
the small patch which reports the bind-parameter together with
the SQL statement on an error.

You can't invoke user-defined I/O functions in an already-failed
transaction. For that matter, you shouldn't really even try to do the
catalog lookups involved in identifying them.

regards, tom lane